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;
|