u.h 2.8 KB

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