u.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #define nil ((void*)0)
  2. typedef unsigned short ushort;
  3. typedef unsigned char uchar;
  4. typedef unsigned long ulong;
  5. typedef unsigned int uint;
  6. typedef signed char schar;
  7. typedef long long vlong;
  8. typedef unsigned long long uvlong;
  9. typedef ushort Rune;
  10. typedef union FPdbleword FPdbleword;
  11. typedef long jmp_buf[2];
  12. #define JMPBUFSP 0
  13. #define JMPBUFPC 1
  14. #define JMPBUFDPC 0
  15. typedef unsigned int mpdigit; /* for /sys/include/mp.h */
  16. typedef unsigned char u8int;
  17. typedef unsigned short u16int;
  18. typedef unsigned int u32int;
  19. typedef unsigned long long u64int;
  20. /* FPSCR */
  21. #define FPSFX (1<<31) /* exception summary (sticky) */
  22. #define FPSEX (1<<30) /* enabled exception summary */
  23. #define FPSVX (1<<29) /* invalid operation exception summary */
  24. #define FPSOX (1<<28) /* overflow exception OX (sticky) */
  25. #define FPSUX (1<<27) /* underflow exception UX (sticky) */
  26. #define FPSZX (1<<26) /* zero divide exception ZX (sticky) */
  27. #define FPSXX (1<<25) /* inexact exception XX (sticky) */
  28. #define FPSVXSNAN (1<<24) /* invalid operation exception for SNaN (sticky) */
  29. #define FPSVXISI (1<<23) /* invalid operation exception for ∞-∞ (sticky) */
  30. #define FPSVXIDI (1<<22) /* invalid operation exception for ∞/∞ (sticky) */
  31. #define FPSVXZDZ (1<<21) /* invalid operation exception for 0/0 (sticky) */
  32. #define FPSVXIMZ (1<<20) /* invalid operation exception for ∞*0 (sticky) */
  33. #define FPSVXVC (1<<19) /* invalid operation exception for invalid compare (sticky) */
  34. #define FPSFR (1<<18) /* fraction rounded */
  35. #define FPSFI (1<<17) /* fraction inexact */
  36. #define FPSFPRF (1<<16) /* floating point result class */
  37. #define FPSFPCC (0xF<<12) /* <, >, =, unordered */
  38. #define FPVXCVI (1<<8) /* enable exception for invalid integer convert (sticky) */
  39. #define FPVE (1<<7) /* invalid operation exception enable */
  40. #define FPOVFL (1<<6) /* enable overflow exceptions */
  41. #define FPUNFL (1<<5) /* enable underflow */
  42. #define FPZDIV (1<<4) /* enable zero divide */
  43. #define FPINEX (1<<3) /* enable inexact exceptions */
  44. #define FPRMASK (3<<0) /* rounding mode */
  45. #define FPRNR (0<<0)
  46. #define FPRZ (1<<0)
  47. #define FPRPINF (2<<0)
  48. #define FPRNINF (3<<0)
  49. #define FPPEXT 0
  50. #define FPPSGL 0
  51. #define FPPDBL 0
  52. #define FPPMASK 0
  53. #define FPINVAL FPVE
  54. #define FPAOVFL FPSOX
  55. #define FPAINEX FPSXX
  56. #define FPAUNFL FPSUX
  57. #define FPAZDIV FPSZX
  58. #define FPAINVAL FPSVX
  59. union FPdbleword
  60. {
  61. double x;
  62. struct { /* big endian */
  63. ulong hi;
  64. ulong lo;
  65. };
  66. };
  67. typedef char* va_list;
  68. #define va_start(list, start) list =\
  69. (sizeof(start) < 4?\
  70. (char*)((int*)&(start)+1):\
  71. (char*)(&(start)+1))
  72. #define va_end(list)\
  73. USED(list)
  74. #define va_arg(list, mode)\
  75. ((sizeof(mode) == 1)?\
  76. ((mode*)(list += 4))[-1]:\
  77. (sizeof(mode) == 2)?\
  78. ((mode*)(list += 4))[-1]:\
  79. ((mode*)(list += sizeof(mode)))[-1])