gba-trycatch
annotate src/fixed.h @ 13:2070a81127f2
foo
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 23 Jun 2014 08:28:28 +0300 |
parents | 158d23956801 |
children |
rev | line source |
---|---|
nuclear@4 | 1 #ifndef FIXED_H_ |
nuclear@4 | 2 #define FIXED_H_ |
nuclear@4 | 3 |
nuclear@4 | 4 #include <stdint.h> |
nuclear@4 | 5 |
nuclear@7 | 6 #define ftox16(x) (int32_t)((x) * 65536.0f) |
nuclear@7 | 7 #define itox16(x) (int32_t)((x) << 16) |
nuclear@7 | 8 |
nuclear@7 | 9 #define x16tof(x) (float)((x) / 65536.0f) |
nuclear@7 | 10 #define x16toi(x) ((x) >> 16) |
nuclear@7 | 11 |
nuclear@4 | 12 #define x16mul(a, b) (int32_t)(((int32_t)(a) >> 8) * ((int32_t)(b) >> 8)) |
nuclear@4 | 13 /*int32_t x16div(register int32_t num, register int32_t denom);*/ |
nuclear@4 | 14 #define x16div(a, b) (int32_t)(((int64_t)(a) << 16) / (b)) |
nuclear@4 | 15 |
nuclear@8 | 16 #define x16sq(x) x16mul(x, x) |
nuclear@8 | 17 |
nuclear@4 | 18 #endif /* FIXED_H_ */ |