To avoid improper typecasting
float x= -10.5; int *p = (int *)&x *p &= 0x7FFFFFFF;
This is fun What''s next...
float x= -10.5; int *p = (int *)&x *p &= 0x7FFFFFFF;
quote: Original post by Anonymous Poster
You would only see a performance increase if you were bit shifting an unsigned int instead of an int. The compiler has to do a bunch of stuff behind the scenes to take care of the topmost bit....my professor tested this is one of our classes in the bilinear filtering algorithm....there was a 10% increase in speed when shifting the unsigned int... try testing it for yourself, you should see and increase.
quote: Original post by baskuenen
- Use some asm FPU pipelining optimization. Use the FSQRT function - not the C version.
My Page davepermen.net | My Music on Bandcamp and on Soundcloud
quote:
float x= -10.5; int *p = (int *)&x *p &= 0x7FFFFFFF;
My Page davepermen.net | My Music on Bandcamp and on Soundcloud
// This changes to absolute the value of the parameter// and return the value.#define fabs(x) (*((float*)(*((long*)&x) &= 0x7FFFFFFF)))
quote: Original post by Poltras
Baskuenen
If you''re seeking for fun, you should check out the International Obfuscated C Code Contest... I will participate next year (this year''s round is already over) and it is very cool.
Watch out they are often using Watcom and Linux... (I''ve downloaded DjGPP for compiling most of entries and 90% work).
#define fabs(x) (*((float*)(*((long*)&(x)) &= 0x7FFFFFFF)))