u.h 2.7 KB

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