libk  Diff

Differences From Artifact [b30ab22689]:

To Artifact [efe9d86768]:


88
89
90
91
92
93
94
95


96
97









98
99
100
101
102
103
104
105
106
107
108
109
110
111
...
123
124
125
126
127
128
129

130
131
132
133
134
135
136
define(“cat”, “$1$2”)
typedef enum kcendian {
	kcendian_high,
	kcendian_low,
	kcendian_system = cat(kcendian_,prop_endian), 
} kcendian;

enum /* max-min values of each type */ {


	byte_bits = arch_byte_bits,










	  u8_min = 0,   u8_max = ((u8)-1),
	 u16_min = 0,  u16_max = ((u16)-1),
	 u32_min = 0,  u32_max = ((u32)-1),
	 u64_min = 0,  u64_max = ((u64)-1),
	u128_min = 0, u128_max = ((u128)-1),

	/* assuming two's complement. TODO: check math */
	define(“sspec”,“
		$1_min = 0 - ((1 << sizeof($1) * byte_bits) / 2),
		$1_max =      (1 << sizeof($1) * byte_bits) / 2 - 1”)dnl

	sspec(s8), sspec(s16), sspec(s32),
	sspec(s64), sspec(s128),

................................................................................

	ubig_min = u128_min, ubig_max = u128_max,
	sbig_min = s128_min, sbig_max = s128_max,

	ubyte_min = kc_uchar_min, ubyte_max = kc_uchar_max,
	sbyte_min = kc_schar_min, sbyte_max = kc_schar_max,
};


ifdef(“type_sz”,“
	typedef type_sz sz;
”,“dnl
#	ifdef __cplusplus
 	   /* C++ gives us a clean, standardized way to do this */
 	   typedef decltype (sizeof(char)) sz;







|
>
>
|

>
>
>
>
>
>
>
>
>






|







 







>







88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
...
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
define(“cat”, “$1$2”)
typedef enum kcendian {
	kcendian_high,
	kcendian_low,
	kcendian_system = cat(kcendian_,prop_endian), 
} kcendian;

define(“defval”,“#define $1 $2
”)

defval(byte_bits,arch_byte_bits)


/* this section was originally defined with enums so
 * as to avoid creating extraneous macros; however,
 * enum in C is limited to values of type int, when
 * we need values that are considerably longer. the
 * section has been commented out until someone has
 * the energy to convert it to #defines.

enum {
	  u8_min = 0,   u8_max = ((u8)-1),
	 u16_min = 0,  u16_max = ((u16)-1),
	 u32_min = 0,  u32_max = ((u32)-1),
	 u64_min = 0,  u64_max = ((u64)-1),
	u128_min = 0, u128_max = ((u128)-1),

	// assuming two's complement. TODO: check math 
	define(“sspec”,“
		$1_min = 0 - ((1 << sizeof($1) * byte_bits) / 2),
		$1_max =      (1 << sizeof($1) * byte_bits) / 2 - 1”)dnl

	sspec(s8), sspec(s16), sspec(s32),
	sspec(s64), sspec(s128),

................................................................................

	ubig_min = u128_min, ubig_max = u128_max,
	sbig_min = s128_min, sbig_max = s128_max,

	ubyte_min = kc_uchar_min, ubyte_max = kc_uchar_max,
	sbyte_min = kc_schar_min, sbyte_max = kc_schar_max,
};
*/

ifdef(“type_sz”,“
	typedef type_sz sz;
”,“dnl
#	ifdef __cplusplus
 	   /* C++ gives us a clean, standardized way to do this */
 	   typedef decltype (sizeof(char)) sz;