util  Check-in [da3eccdcfa]

Overview
Comment:fix static assert
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: da3eccdcfad7f7077c35b8059a71a2aa3375ed49d5f6e83b4a6944e06f639312
User & Date: lexi on 2019-07-19 11:50:51
Other Links: manifest | tags
Context
2019-07-19
12:07
fxi ubgs check-in: 8ce91f9627 user: lexi tags: trunk
11:50
fix static assert check-in: da3eccdcfa user: lexi tags: trunk
11:47
switch from syscall to getrandom check-in: 6b3b3fa87f user: lexi tags: trunk
Changes

Modified clib/iaia.c from [b9f828e90b] to [f7f2775d1b].

97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
 * this table needs to be kept in sync with the
 * itoa algorithm by hand. unfortunately, given C's
 * abject lack of metaprogramming, we have to do this
 * by hand. */
const char iaia_ref_table[] = /* numerals[10] */ "0123456789"
	/* bigalpha[26] */ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	/* smallalpha[26] */ "abcdefghijklmnopqrstuvwxyz";
_Static_assert (sizeof iaia_ref_table - 1 == maxbase);

iaia_error_type _IAIA_FN_ITOASC(iaia_word_type val, const char* buf_start, char* buf_end, char** newbuf) {
	char* ptr = buf_end;

	*ptr-- = 0;
	while(val > 0) {
		if (ptr < buf_start) return iaia_e_overflow;







|







97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
 * this table needs to be kept in sync with the
 * itoa algorithm by hand. unfortunately, given C's
 * abject lack of metaprogramming, we have to do this
 * by hand. */
const char iaia_ref_table[] = /* numerals[10] */ "0123456789"
	/* bigalpha[26] */ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	/* smallalpha[26] */ "abcdefghijklmnopqrstuvwxyz";
_Static_assert (sizeof iaia_ref_table - 1 == maxbase, "tables out of sync");

iaia_error_type _IAIA_FN_ITOASC(iaia_word_type val, const char* buf_start, char* buf_end, char** newbuf) {
	char* ptr = buf_end;

	*ptr-- = 0;
	while(val > 0) {
		if (ptr < buf_start) return iaia_e_overflow;