A benchmark of the digitization algorithm in AliRoot for the ALICE experiment showed a considerable number of function calls to TMath::Nint(...) in inner loops.
It would be beneficial to have an inlined implementation of this function directly in the TMath.h header. Further, I suggest to provide this as a template function (see below) to avoid code duplication between Float_t and Double_t.
Another improvement could be the inversion of floating point operation and the test for evenness ( i & 1 && x + 0.5 == T )
// possible inline implementation of the Nint function
template<typename T>
inline Int_t TMath::Nint(T x)
{
// Round to nearest integer. Rounds half integers to the nearest
// even integer.
int i;
if (x >= 0)
{
i = int(x + 0.5);
if ( i & 1 && x + 0.5 == T(i) ) i;
}
else
{
i = int(x  0.5);
if ( i & 1 && x  0.5 == T(i) ) i++;
}
return i;
}
