Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Fast C++ Code Library

  • 02-12-2002 2:42pm
    #1
    Registered Users, Registered Users 2 Posts: 1,481 ✭✭✭


    I found this code on a Korean site last night. Seems like some very handy stuff (especially for graphics/games - see the Quake 3 reciprocal square root below, mmm...) - although I haven't actually used any of these yet, so use at your own risk.

    (It's too big to post up here... FastCodeLibrary.h)

    Example:
    [PHP]// Fast reciprocal square root (Quake 3 game code)
    __inline float RSqrt(float number)
    {
    long i;
    float x2, y;
    const float threehalfs = 1.5f;

    x2 = number * 0.5f;
    y = number;
    i = * (long *) &y; // evil floating point bit level hacking
    i = 0x5f3759df - (i >> 1); // what the f*ck?
    y = * (float *) &i;
    y = y * (threehalfs - (x2 * y * y)); // 1st iteration

    return y;
    }[/PHP]


Comments

  • Registered Users, Registered Users 2 Posts: 95 ✭✭Mr.StRiPe


    Nice one keith I was actuall looking for code like that. Hows the postgrad going?


  • Registered Users, Registered Users 2 Posts: 1,481 ✭✭✭satchmo


    It's goin great except for Charlie 'Fuckwit' McCreevy cutting practically the whole project equipment budget for the next year, along with a number of other projects. How the hell am I meant to build a CAVE with no bloody equipment, eh?!


Advertisement