Implement u128/i128 features; Add bits.odin

This commit is contained in:
Ginger Bill
2017-06-01 14:23:46 +01:00
parent fec6df65b3
commit 0d4945dc87
13 changed files with 497 additions and 303 deletions
+8 -5
View File
@@ -6384,20 +6384,23 @@ gb_global char const gb__num_to_char_table[] =
gb_inline void gb_i64_to_str(i64 value, char *string, i32 base) {
char *buf = string;
b32 negative = false;
u64 v;
if (value < 0) {
negative = true;
value = -value;
}
if (value) {
while (value > 0) {
*buf++ = gb__num_to_char_table[value % base];
value /= base;
v = cast(u64)value;
if (v != 0) {
while (v > 0) {
*buf++ = gb__num_to_char_table[v % base];
v /= base;
}
} else {
*buf++ = '0';
}
if (negative)
if (negative) {
*buf++ = '-';
}
*buf = '\0';
gb_strrev(string);
}