u.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 unsigned long usize;
  11. typedef ushort Rune;
  12. typedef union FPdbleword FPdbleword;
  13. typedef long 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. /* FCR */
  23. #define FPINEX (1<<30)
  24. #define FPOVFL (1<<19)
  25. #define FPUNFL ((1<<29)|(1<<28))
  26. #define FPZDIV (1<<18)
  27. #define FPINVAL (1<<17)
  28. #define FPRNR (2<<26)
  29. #define FPRZ (0<<26)
  30. #define FPRPINF (3<<26)
  31. #define FPRNINF (1<<26)
  32. #define FPRMASK (3<<26)
  33. #define FPPEXT 0
  34. #define FPPSGL 0
  35. #define FPPDBL 0
  36. #define FPPMASK 0
  37. /* FSR */
  38. #define FPAINEX (1<<24)
  39. #define FPAUNFL (1<<23)
  40. #define FPAOVFL (1<<22)
  41. #define FPAZDIV (1<<21)
  42. #define FPAINVAL (1<<20)
  43. union FPdbleword
  44. {
  45. double x;
  46. struct { /* little endian */
  47. ulong lo;
  48. ulong hi;
  49. };
  50. };
  51. /* stdarg */
  52. typedef char* va_list;
  53. #define va_start(list, start) list =\
  54. (sizeof(start) < 4?\
  55. (char*)((int*)&(start)+1):\
  56. (char*)(&(start)+1))
  57. #define va_end(list)\
  58. USED(list)
  59. #define va_arg(list, mode)\
  60. ((sizeof(mode) == 1)?\
  61. ((list += 4), (mode*)list)[-4]:\
  62. (sizeof(mode) == 2)?\
  63. ((list += 4), (mode*)list)[-2]:\
  64. sizeof(mode)>4?\
  65. ((mode*)(list = (char*)((uintptr)(list+7) & ~7) + sizeof(mode)))[-1]:\
  66. ((list += sizeof(mode)), (mode*)list)[-1])