u.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 uint 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. /* MXCSR */
  23. /* fcr */
  24. #define FPFTZ (1<<15) /* amd64 */
  25. #define FPINEX (1<<12)
  26. #define FPUNFL (1<<11)
  27. #define FPOVFL (1<<10)
  28. #define FPZDIV (1<<9)
  29. #define FPDNRM (1<<8) /* amd64 */
  30. #define FPINVAL (1<<7)
  31. #define FPDAZ (1<<6) /* amd64 */
  32. #define FPRNR (0<<13)
  33. #define FPRZ (3<<13)
  34. #define FPRPINF (2<<13)
  35. #define FPRNINF (1<<13)
  36. #define FPRMASK (3<<13)
  37. #define FPPEXT 0
  38. #define FPPSGL 0
  39. #define FPPDBL 0
  40. #define FPPMASK 0
  41. /* fsr */
  42. #define FPAINEX (1<<5)
  43. #define FPAUNFL (1<<4)
  44. #define FPAOVFL (1<<3)
  45. #define FPAZDIV (1<<2)
  46. #define FPADNRM (1<<1) /* not in plan 9 */
  47. #define FPAINVAL (1<<0)
  48. union FPdbleword
  49. {
  50. double x;
  51. struct { /* little endian */
  52. uint lo;
  53. uint hi;
  54. };
  55. };
  56. typedef char* va_list;
  57. #define va_start(list, start) list =\
  58. (sizeof(start) < 8?\
  59. (char*)((vlong*)&(start)+1):\
  60. (char*)(&(start)+1))
  61. #define va_end(list)\
  62. USED(list)
  63. #define va_arg(list, mode)\
  64. ((sizeof(mode) == 1)?\
  65. ((list += 8), (mode*)list)[-8]:\
  66. (sizeof(mode) == 2)?\
  67. ((list += 8), (mode*)list)[-4]:\
  68. (sizeof(mode) == 4)?\
  69. ((list += 8), (mode*)list)[-2]:\
  70. ((list += sizeof(mode)), (mode*)list)[-1])