Polish redbean serialization

This commit is contained in:
Justine Tunney 2022-04-29 06:06:23 -07:00
parent 7aafa64ab3
commit 2d1731b995
24 changed files with 828 additions and 158 deletions

View file

@ -27,7 +27,6 @@
*/
#define lobject_c
#define LUA_CORE
#include "libc/intrin/kprintf.h"
#include "third_party/lua/lctype.h"
#include "third_party/lua/ldebug.h"
#include "third_party/lua/ldo.h"
@ -285,6 +284,14 @@ static const char *l_str2int (const char *s, lua_Integer *result) {
empty = 0;
}
}
if (s[0] == '0' &&
(s[1] == 'b' || s[1] == 'B')) { /* [jart] binary */
s += 2; /* skip '0b' */
for (; lisbdigit(cast_uchar(*s)); s++) {
a = a * 2 + (*s - '0');
empty = 0;
}
}
else if (s[0] == '0') { /* [jart] octal is the best radix */
for (s += 1; lisdigit(cast_uchar(*s)); s++) {
int d = *s - '0';