GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: No Line Numbers


Fast float->int truncs by dranith
1
 
inline int FloatToInt( float f ) {
    f -= 0.5f;

    int convert;
    __asm fld    f;
    __asm fistp convert;
    return convert;
}

inline void FloatToInt(int *int_pointer, float f)
{
    f -= 0.5f;
    __asm  fld  f
    __asm  mov  edx,int_pointer
    __asm  FRNDINT
    __asm  fistp dword ptr [edx];
}