diff --git a/libc3/abs.c b/libc3/abs.c
new file mode 100644
index 0000000..182ce8c
--- /dev/null
+++ b/libc3/abs.c
@@ -0,0 +1,38 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+#include "abs.h"
+
+#define DEF_ABS_S(bits) \
+ s ## bits abs_s ## bits (s ## bits a) \
+ { \
+ if (a < 0) \
+ a = -a; \
+ return a; \
+ }
+
+#define DEF_ABS_U(bits) \
+ u ## bits abs_u ## bits (u ## bits a) \
+ { \
+ return a; \
+ }
+
+DEF_ABS_S(8)
+DEF_ABS_S(16)
+DEF_ABS_S(32)
+DEF_ABS_S(64)
+DEF_ABS_S(w)
+DEF_ABS_U(8)
+DEF_ABS_U(16)
+DEF_ABS_U(32)
+DEF_ABS_U(64)
+DEF_ABS_U(w)
diff --git a/libc3/abs.h b/libc3/abs.h
new file mode 100644
index 0000000..6b8d7d3
--- /dev/null
+++ b/libc3/abs.h
@@ -0,0 +1,38 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/**
+ * @file abs.h
+ * @brief Mathematical absolute value
+ *
+ * Functions that return the absolute value of a number.
+ */
+#ifndef ABS_H
+#define ABS_H
+
+#include "types.h"
+
+#define DEF_ABS_PROTOTYPE(type) \
+ type abs_ ## type (type a)
+
+DEF_ABS_PROTOTYPE(s8);
+DEF_ABS_PROTOTYPE(s16);
+DEF_ABS_PROTOTYPE(s32);
+DEF_ABS_PROTOTYPE(s64);
+DEF_ABS_PROTOTYPE(sw);
+DEF_ABS_PROTOTYPE(u8);
+DEF_ABS_PROTOTYPE(u16);
+DEF_ABS_PROTOTYPE(u32);
+DEF_ABS_PROTOTYPE(u64);
+DEF_ABS_PROTOTYPE(uw);
+
+#endif /* ABS_H */
diff --git a/libc3/ceiling.c b/libc3/ceiling.c
index 8b232d8..f9d01b4 100644
--- a/libc3/ceiling.c
+++ b/libc3/ceiling.c
@@ -10,21 +10,29 @@
* AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
* THIS SOFTWARE.
*/
+#include "abs.h"
#include "ceiling.h"
+#include "sign.h"
-#define DEF_CEILING(type) \
- type ceiling_ ## type (type a, type b) \
+#define DEF_CEILING_S(bits, bits2) \
+ s ## bits ceiling_s ## bits (s ## bits a, s ## bits b) \
{ \
- return (a + (b - 1)) / b; \
- } \
+ s ## bits sign; \
+ sign = sign_s ## bits (a) * sign_s ## bits (b); \
+ a = abs_s ## bits (a); \
+ b = abs_s ## bits (b); \
+ return (s ## bits) (sign * ((s ## bits2) a + (b - 1)) / b); \
+ }
-DEF_CEILING(s8)
-DEF_CEILING(s16)
-DEF_CEILING(s32)
-DEF_CEILING(s64)
-DEF_CEILING(sw)
-DEF_CEILING(u8)
-DEF_CEILING(u16)
-DEF_CEILING(u32)
-DEF_CEILING(u64)
-DEF_CEILING(uw)
+#define DEF_CEILING_U(bits, bits2) \
+ u ## bits ceiling_u ## bits (u ## bits a, u ## bits b) \
+ { \
+ return (u ## bits) (((u ## bits2) a + (b - 1)) / b); \
+ }
+
+DEF_CEILING_S(8, 16)
+DEF_CEILING_S(16, 32)
+DEF_CEILING_S(32, 64)
+DEF_CEILING_U(8, 16)
+DEF_CEILING_U(16, 32)
+DEF_CEILING_U(32, 64)
diff --git a/libc3/sign.c b/libc3/sign.c
new file mode 100644
index 0000000..1761a5d
--- /dev/null
+++ b/libc3/sign.c
@@ -0,0 +1,29 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+#include "sign.h"
+
+#define DEF_SIGN_S(bits) \
+ s ## bits sign_s ## bits (s ## bits a) \
+ { \
+ if (a < 0) \
+ return -1; \
+ if (a == 0) \
+ return 0; \
+ return 1; \
+ }
+
+DEF_SIGN_S(8)
+DEF_SIGN_S(16)
+DEF_SIGN_S(32)
+DEF_SIGN_S(64)
+DEF_SIGN_S(w)
diff --git a/libc3/sign.h b/libc3/sign.h
new file mode 100644
index 0000000..f240646
--- /dev/null
+++ b/libc3/sign.h
@@ -0,0 +1,38 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/**
+ * @file sign.h
+ * @brief Get the sign of a number
+ *
+ * Functions that return the sign of a number.
+ */
+#ifndef SIGN_H
+#define SIGN_H
+
+#include "types.h"
+
+#define DEF_SIGN_PROTOTYPE(type) \
+ type sign_ ## type (type a)
+
+DEF_SIGN_PROTOTYPE(s8);
+DEF_SIGN_PROTOTYPE(s16);
+DEF_SIGN_PROTOTYPE(s32);
+DEF_SIGN_PROTOTYPE(s64);
+DEF_SIGN_PROTOTYPE(sw);
+DEF_SIGN_PROTOTYPE(u8);
+DEF_SIGN_PROTOTYPE(u16);
+DEF_SIGN_PROTOTYPE(u32);
+DEF_SIGN_PROTOTYPE(u64);
+DEF_SIGN_PROTOTYPE(uw);
+
+#endif /* SIGN_H */
diff --git a/libc3/sources.mk b/libc3/sources.mk
index dd5e7bf..2792a80 100644
--- a/libc3/sources.mk
+++ b/libc3/sources.mk
@@ -1,5 +1,6 @@
# sources.mk generated by update_sources
HEADERS = \
+ abs.h \
arg.h \
array.h \
binding.h \
@@ -47,6 +48,7 @@ HEADERS = \
set_item__fact.h \
set_item__tag.h \
sha1.h \
+ sign.h \
skiplist__fact.h \
skiplist_node__fact.h \
str.h \
@@ -57,6 +59,7 @@ HEADERS = \
ucd.h \
SOURCES = \
+ abs.c \
arg.c \
array.c \
binding.c \
@@ -101,6 +104,7 @@ SOURCES = \
set_cursor__tag.c \
set_item__fact.c \
set_item__tag.c \
+ sign.c \
skiplist__fact.c \
skiplist_node__fact.c \
str.c \
@@ -110,6 +114,7 @@ SOURCES = \
ucd.c \
LO_SOURCES = \
+ abs.c \
arg.c \
array.c \
binding.c \
@@ -154,6 +159,7 @@ LO_SOURCES = \
set_cursor__tag.c \
set_item__fact.c \
set_item__tag.c \
+ sign.c \
skiplist__fact.c \
skiplist_node__fact.c \
str.c \
diff --git a/libc3/sources.sh b/libc3/sources.sh
index 90c99b7..e2be60c 100644
--- a/libc3/sources.sh
+++ b/libc3/sources.sh
@@ -1,4 +1,4 @@
# sources.sh generated by update_sources
-HEADERS='arg.h array.h binding.h bool.h buf.h buf_file.h buf_inspect.h buf_parse.h buf_parse_c.h buf_save.h c3.h c_types.h call.h ceiling.h cfn.h character.h compare.h config.h env.h error.h error_handler.h eval.h fact.h facts.h facts_cursor.h facts_spec.h facts_spec_cursor.h facts_with.h facts_with_cursor.h fn.h frame.h hash.h ident.h integer.h io.h list.h log.h module.h operator.h quote.h set__fact.h set__tag.h set_cursor__fact.h set_cursor__tag.h set_item__fact.h set_item__tag.h sha1.h skiplist__fact.h skiplist_node__fact.h str.h sym.h tag.h tuple.h types.h ucd.h '
-SOURCES='arg.c array.c binding.c bool.c buf.c buf_file.c buf_inspect.c buf_parse.c buf_parse_c.c buf_save.c c3.c call.c ceiling.c cfn.c character.c compare.c env.c error.c error_handler.c eval.c fact.c facts.c facts_cursor.c facts_spec.c facts_spec_cursor.c facts_with.c facts_with_cursor.c fn.c frame.c hash.c ident.c integer.c io.c list.c log.c module.c operator.c quote.c set__fact.c set__tag.c set_cursor__fact.c set_cursor__tag.c set_item__fact.c set_item__tag.c skiplist__fact.c skiplist_node__fact.c str.c sym.c tag.c tuple.c ucd.c '
-LO_SOURCES='arg.c array.c binding.c bool.c buf.c buf_file.c buf_inspect.c buf_parse.c buf_parse_c.c buf_save.c c3.c call.c ceiling.c cfn.c character.c compare.c env.c error.c error_handler.c eval.c fact.c facts.c facts_cursor.c facts_spec.c facts_spec_cursor.c facts_with.c facts_with_cursor.c fn.c frame.c hash.c ident.c integer.c io.c list.c log.c module.c operator.c quote.c set__fact.c set__tag.c set_cursor__fact.c set_cursor__tag.c set_item__fact.c set_item__tag.c skiplist__fact.c skiplist_node__fact.c str.c sym.c tag.c tuple.c ucd.c ../libtommath/bn_cutoffs.c ../libtommath/bn_mp_2expt.c ../libtommath/bn_mp_abs.c ../libtommath/bn_mp_add.c ../libtommath/bn_mp_add_d.c ../libtommath/bn_mp_and.c ../libtommath/bn_mp_clamp.c ../libtommath/bn_mp_clear.c ../libtommath/bn_mp_clear_multi.c ../libtommath/bn_mp_cmp.c ../libtommath/bn_mp_cmp_d.c ../libtommath/bn_mp_cmp_mag.c ../libtommath/bn_mp_cnt_lsb.c ../libtommath/bn_mp_complement.c ../libtommath/bn_mp_copy.c ../libtommath/bn_mp_count_bits.c ../libtommath/bn_mp_div.c ../libtommath/bn_mp_div_2.c ../libtommath/bn_mp_div_2d.c ../libtommath/bn_mp_div_3.c ../libtommath/bn_mp_div_d.c ../libtommath/bn_mp_dr_is_modulus.c ../libtommath/bn_mp_dr_reduce.c ../libtommath/bn_mp_dr_setup.c ../libtommath/bn_mp_error_to_string.c ../libtommath/bn_mp_exch.c ../libtommath/bn_mp_exptmod.c ../libtommath/bn_mp_gcd.c ../libtommath/bn_mp_get_i32.c ../libtommath/bn_mp_get_i64.c ../libtommath/bn_mp_get_mag_u32.c ../libtommath/bn_mp_get_mag_u64.c ../libtommath/bn_mp_grow.c ../libtommath/bn_mp_init.c ../libtommath/bn_mp_init_copy.c ../libtommath/bn_mp_init_multi.c ../libtommath/bn_mp_init_size.c ../libtommath/bn_mp_invmod.c ../libtommath/bn_mp_lcm.c ../libtommath/bn_mp_lshd.c ../libtommath/bn_mp_mod.c ../libtommath/bn_mp_mod_2d.c ../libtommath/bn_mp_montgomery_calc_normalization.c ../libtommath/bn_mp_montgomery_reduce.c ../libtommath/bn_mp_montgomery_setup.c ../libtommath/bn_mp_mul.c ../libtommath/bn_mp_mul_2.c ../libtommath/bn_mp_mul_2d.c ../libtommath/bn_mp_mul_d.c ../libtommath/bn_mp_mulmod.c ../libtommath/bn_mp_neg.c ../libtommath/bn_mp_or.c ../libtommath/bn_mp_radix_size.c ../libtommath/bn_mp_reduce.c ../libtommath/bn_mp_reduce_2k.c ../libtommath/bn_mp_reduce_2k_l.c ../libtommath/bn_mp_reduce_2k_setup.c ../libtommath/bn_mp_reduce_2k_setup_l.c ../libtommath/bn_mp_reduce_is_2k.c ../libtommath/bn_mp_reduce_is_2k_l.c ../libtommath/bn_mp_reduce_setup.c ../libtommath/bn_mp_rshd.c ../libtommath/bn_mp_set.c ../libtommath/bn_mp_sqr.c ../libtommath/bn_mp_sqrt.c ../libtommath/bn_mp_sub.c ../libtommath/bn_mp_sub_d.c ../libtommath/bn_mp_xor.c ../libtommath/bn_mp_zero.c ../libtommath/bn_s_mp_add.c ../libtommath/bn_s_mp_balance_mul.c ../libtommath/bn_s_mp_exptmod.c ../libtommath/bn_s_mp_exptmod_fast.c ../libtommath/bn_s_mp_invmod_fast.c ../libtommath/bn_s_mp_invmod_slow.c ../libtommath/bn_s_mp_karatsuba_mul.c ../libtommath/bn_s_mp_karatsuba_sqr.c ../libtommath/bn_s_mp_montgomery_reduce_fast.c ../libtommath/bn_s_mp_mul_digs.c ../libtommath/bn_s_mp_mul_digs_fast.c ../libtommath/bn_s_mp_mul_high_digs.c ../libtommath/bn_s_mp_mul_high_digs_fast.c ../libtommath/bn_s_mp_rand_platform.c ../libtommath/bn_s_mp_sqr.c ../libtommath/bn_s_mp_sqr_fast.c ../libtommath/bn_s_mp_sub.c ../libtommath/bn_s_mp_toom_mul.c ../libtommath/bn_s_mp_toom_sqr.c '
+HEADERS='abs.h arg.h array.h binding.h bool.h buf.h buf_file.h buf_inspect.h buf_parse.h buf_parse_c.h buf_save.h c3.h c_types.h call.h ceiling.h cfn.h character.h compare.h config.h env.h error.h error_handler.h eval.h fact.h facts.h facts_cursor.h facts_spec.h facts_spec_cursor.h facts_with.h facts_with_cursor.h fn.h frame.h hash.h ident.h integer.h io.h list.h log.h module.h operator.h quote.h set__fact.h set__tag.h set_cursor__fact.h set_cursor__tag.h set_item__fact.h set_item__tag.h sha1.h sign.h skiplist__fact.h skiplist_node__fact.h str.h sym.h tag.h tuple.h types.h ucd.h '
+SOURCES='abs.c arg.c array.c binding.c bool.c buf.c buf_file.c buf_inspect.c buf_parse.c buf_parse_c.c buf_save.c c3.c call.c ceiling.c cfn.c character.c compare.c env.c error.c error_handler.c eval.c fact.c facts.c facts_cursor.c facts_spec.c facts_spec_cursor.c facts_with.c facts_with_cursor.c fn.c frame.c hash.c ident.c integer.c io.c list.c log.c module.c operator.c quote.c set__fact.c set__tag.c set_cursor__fact.c set_cursor__tag.c set_item__fact.c set_item__tag.c sign.c skiplist__fact.c skiplist_node__fact.c str.c sym.c tag.c tuple.c ucd.c '
+LO_SOURCES='abs.c arg.c array.c binding.c bool.c buf.c buf_file.c buf_inspect.c buf_parse.c buf_parse_c.c buf_save.c c3.c call.c ceiling.c cfn.c character.c compare.c env.c error.c error_handler.c eval.c fact.c facts.c facts_cursor.c facts_spec.c facts_spec_cursor.c facts_with.c facts_with_cursor.c fn.c frame.c hash.c ident.c integer.c io.c list.c log.c module.c operator.c quote.c set__fact.c set__tag.c set_cursor__fact.c set_cursor__tag.c set_item__fact.c set_item__tag.c sign.c skiplist__fact.c skiplist_node__fact.c str.c sym.c tag.c tuple.c ucd.c ../libtommath/bn_cutoffs.c ../libtommath/bn_mp_2expt.c ../libtommath/bn_mp_abs.c ../libtommath/bn_mp_add.c ../libtommath/bn_mp_add_d.c ../libtommath/bn_mp_and.c ../libtommath/bn_mp_clamp.c ../libtommath/bn_mp_clear.c ../libtommath/bn_mp_clear_multi.c ../libtommath/bn_mp_cmp.c ../libtommath/bn_mp_cmp_d.c ../libtommath/bn_mp_cmp_mag.c ../libtommath/bn_mp_cnt_lsb.c ../libtommath/bn_mp_complement.c ../libtommath/bn_mp_copy.c ../libtommath/bn_mp_count_bits.c ../libtommath/bn_mp_div.c ../libtommath/bn_mp_div_2.c ../libtommath/bn_mp_div_2d.c ../libtommath/bn_mp_div_3.c ../libtommath/bn_mp_div_d.c ../libtommath/bn_mp_dr_is_modulus.c ../libtommath/bn_mp_dr_reduce.c ../libtommath/bn_mp_dr_setup.c ../libtommath/bn_mp_error_to_string.c ../libtommath/bn_mp_exch.c ../libtommath/bn_mp_exptmod.c ../libtommath/bn_mp_gcd.c ../libtommath/bn_mp_get_i32.c ../libtommath/bn_mp_get_i64.c ../libtommath/bn_mp_get_mag_u32.c ../libtommath/bn_mp_get_mag_u64.c ../libtommath/bn_mp_grow.c ../libtommath/bn_mp_init.c ../libtommath/bn_mp_init_copy.c ../libtommath/bn_mp_init_multi.c ../libtommath/bn_mp_init_size.c ../libtommath/bn_mp_invmod.c ../libtommath/bn_mp_lcm.c ../libtommath/bn_mp_lshd.c ../libtommath/bn_mp_mod.c ../libtommath/bn_mp_mod_2d.c ../libtommath/bn_mp_montgomery_calc_normalization.c ../libtommath/bn_mp_montgomery_reduce.c ../libtommath/bn_mp_montgomery_setup.c ../libtommath/bn_mp_mul.c ../libtommath/bn_mp_mul_2.c ../libtommath/bn_mp_mul_2d.c ../libtommath/bn_mp_mul_d.c ../libtommath/bn_mp_mulmod.c ../libtommath/bn_mp_neg.c ../libtommath/bn_mp_or.c ../libtommath/bn_mp_radix_size.c ../libtommath/bn_mp_reduce.c ../libtommath/bn_mp_reduce_2k.c ../libtommath/bn_mp_reduce_2k_l.c ../libtommath/bn_mp_reduce_2k_setup.c ../libtommath/bn_mp_reduce_2k_setup_l.c ../libtommath/bn_mp_reduce_is_2k.c ../libtommath/bn_mp_reduce_is_2k_l.c ../libtommath/bn_mp_reduce_setup.c ../libtommath/bn_mp_rshd.c ../libtommath/bn_mp_set.c ../libtommath/bn_mp_sqr.c ../libtommath/bn_mp_sqrt.c ../libtommath/bn_mp_sub.c ../libtommath/bn_mp_sub_d.c ../libtommath/bn_mp_xor.c ../libtommath/bn_mp_zero.c ../libtommath/bn_s_mp_add.c ../libtommath/bn_s_mp_balance_mul.c ../libtommath/bn_s_mp_exptmod.c ../libtommath/bn_s_mp_exptmod_fast.c ../libtommath/bn_s_mp_invmod_fast.c ../libtommath/bn_s_mp_invmod_slow.c ../libtommath/bn_s_mp_karatsuba_mul.c ../libtommath/bn_s_mp_karatsuba_sqr.c ../libtommath/bn_s_mp_montgomery_reduce_fast.c ../libtommath/bn_s_mp_mul_digs.c ../libtommath/bn_s_mp_mul_digs_fast.c ../libtommath/bn_s_mp_mul_high_digs.c ../libtommath/bn_s_mp_mul_high_digs_fast.c ../libtommath/bn_s_mp_rand_platform.c ../libtommath/bn_s_mp_sqr.c ../libtommath/bn_s_mp_sqr_fast.c ../libtommath/bn_s_mp_sub.c ../libtommath/bn_s_mp_toom_mul.c ../libtommath/bn_s_mp_toom_sqr.c '
diff --git a/sources.mk b/sources.mk
index 3d69859..57455fa 100644
--- a/sources.mk
+++ b/sources.mk
@@ -88,7 +88,6 @@ C3_C_SOURCES = \
libc3/facts_spec_cursor.h \
libc3/character.h \
libc3/set_cursor__fact.c \
- libc3/c3.c \
libc3/facts_with.c \
libc3/facts_with.h \
libc3/facts_with_cursor.c \
@@ -101,6 +100,7 @@ C3_C_SOURCES = \
libc3/hash.h \
libc3/ident.c \
libc3/ident.h \
+ libc3/abs.h \
libc3/integer.c \
libc3/integer.h \
libc3/list.c \
@@ -111,6 +111,7 @@ C3_C_SOURCES = \
libc3/types.h \
libc3/eval.h \
libc3/cfn.c \
+ libc3/sign.h \
libc3/set.c.in \
libc3/set.h.in \
libc3/set_cursor.c.in \
@@ -127,13 +128,13 @@ C3_C_SOURCES = \
libc3/operator.c \
libc3/operator.h \
libc3/buf_parse.c \
+ libc3/abs.c \
libc3/skiplist.h.in \
libc3/skiplist_node.c.in \
libc3/skiplist_node.h.in \
libc3/str.h \
libc3/sym.c \
libc3/sym.h \
- libc3/tag.c \
libc3/c3.h \
libc3/facts.c \
libc3/buf_inspect.c \
@@ -142,10 +143,13 @@ C3_C_SOURCES = \
libc3/tuple.h \
libc3/ucd.c \
libc3/ucd.h \
+ libc3/c3.c \
libc3/tag.h \
libc3/module.c \
+ libc3/tag.c \
libc3/compare.c \
libc3/cfn.h \
+ libc3/sign.c \
libc3/sha1.h \
test/bool_test.c \
test/buf_file_test.c \
@@ -170,6 +174,7 @@ C3_C_SOURCES = \
test/compare_test.h \
test/skiplist__fact_test.c \
test/str_test.c \
+ test/cfn_test.c \
test/test.c \
test/test.h \
test/sym_test.c \
@@ -177,7 +182,6 @@ C3_C_SOURCES = \
test/tag_test.h \
test/types_test.c \
test/compare_test.c \
- test/cfn_test.c \
ucd2c/ucd.h \
ucd2c/ucd2c.c \
diff --git a/sources.sh b/sources.sh
index f0c3b15..4b30810 100644
--- a/sources.sh
+++ b/sources.sh
@@ -1,4 +1,4 @@
# sources.sh generated by update_sources
C3_CONFIGURES='c3c/configure c3s/configure c3s/update_sources ic3/configure ic3/update_sources libc3/configure libc3/update_sources libtommath/configure libtommath/update_sources test/configure test/update_sources ucd2c/configure '
C3_MAKEFILES='c3c/Makefile c3s/Makefile ic3/Makefile libc3/Makefile libc3/gen.mk libtommath/Makefile test/Makefile ucd2c/Makefile '
-C3_C_SOURCES='c3c/c3c.c c3s/buf_readline.c c3s/c3s.c c3s/buf_readline.h ic3/buf_linenoise.c ic3/buf_linenoise.h ic3/ic3.c ic3/linenoise.c libc3/arg.c libc3/arg.h libc3/binding.c libc3/binding.h libc3/bool.c libc3/bool.h libc3/set_item__tag.c libc3/skiplist_node__fact.c libc3/set__tag.c libc3/set_item__tag.h libc3/set__tag.h libc3/set_cursor__tag.h libc3/set_cursor__tag.c libc3/buf.c libc3/buf.h libc3/buf_file.c libc3/buf_file.h libc3/buf_parse_c.c libc3/buf_parse_c.h libc3/buf_save.c libc3/log.h libc3/skiplist_node__fact.h libc3/skiplist__fact.c libc3/skiplist__fact.h libc3/set_item__fact.h libc3/set_item__fact.c libc3/set__fact.h libc3/set__fact.c libc3/set_cursor__fact.h libc3/compare.h libc3/buf_save.h libc3/env.c libc3/env.h libc3/c_types.h libc3/call.c libc3/call.h libc3/log.c libc3/array.h libc3/error.c libc3/error.h libc3/error_handler.c libc3/error_handler.h libc3/io.c libc3/io.h libc3/fact.h libc3/character.c libc3/array.c libc3/facts.h libc3/facts_cursor.c libc3/facts_cursor.h libc3/facts_spec.c libc3/facts_spec.h libc3/facts_spec_cursor.c libc3/facts_spec_cursor.h libc3/character.h libc3/set_cursor__fact.c libc3/c3.c libc3/facts_with.c libc3/facts_with.h libc3/facts_with_cursor.c libc3/facts_with_cursor.h libc3/fn.c libc3/fn.h libc3/frame.c libc3/frame.h libc3/hash.c libc3/hash.h libc3/ident.c libc3/ident.h libc3/integer.c libc3/integer.h libc3/list.c libc3/list.h libc3/module.h libc3/quote.c libc3/quote.h libc3/types.h libc3/eval.h libc3/cfn.c libc3/set.c.in libc3/set.h.in libc3/set_cursor.c.in libc3/set_cursor.h.in libc3/str.c libc3/eval.c libc3/buf_inspect.h libc3/ceiling.h libc3/ceiling.c libc3/set_item.c.in libc3/set_item.h.in libc3/fact.c libc3/skiplist.c.in libc3/operator.c libc3/operator.h libc3/buf_parse.c libc3/skiplist.h.in libc3/skiplist_node.c.in libc3/skiplist_node.h.in libc3/str.h libc3/sym.c libc3/sym.h libc3/tag.c libc3/c3.h libc3/facts.c libc3/buf_inspect.c libc3/buf_parse.h libc3/tuple.c libc3/tuple.h libc3/ucd.c libc3/ucd.h libc3/tag.h libc3/module.c libc3/compare.c libc3/cfn.h libc3/sha1.h test/bool_test.c test/buf_file_test.c test/buf_inspect_test.c test/buf_parse_test.c test/buf_test.c test/call_test.c test/character_test.c test/hash_test.c test/fact_test.c test/fact_test.h test/facts_cursor_test.c test/facts_test.c test/facts_with_test.c test/ident_test.c test/env_test.c test/libc3_test.c test/tuple_test.c test/list_test.c test/set__fact_test.c test/set__tag_test.c test/compare_test.h test/skiplist__fact_test.c test/str_test.c test/test.c test/test.h test/sym_test.c test/tag_test.c test/tag_test.h test/types_test.c test/compare_test.c test/cfn_test.c ucd2c/ucd.h ucd2c/ucd2c.c '
+C3_C_SOURCES='c3c/c3c.c c3s/buf_readline.c c3s/c3s.c c3s/buf_readline.h ic3/buf_linenoise.c ic3/buf_linenoise.h ic3/ic3.c ic3/linenoise.c libc3/arg.c libc3/arg.h libc3/binding.c libc3/binding.h libc3/bool.c libc3/bool.h libc3/set_item__tag.c libc3/skiplist_node__fact.c libc3/set__tag.c libc3/set_item__tag.h libc3/set__tag.h libc3/set_cursor__tag.h libc3/set_cursor__tag.c libc3/buf.c libc3/buf.h libc3/buf_file.c libc3/buf_file.h libc3/buf_parse_c.c libc3/buf_parse_c.h libc3/buf_save.c libc3/log.h libc3/skiplist_node__fact.h libc3/skiplist__fact.c libc3/skiplist__fact.h libc3/set_item__fact.h libc3/set_item__fact.c libc3/set__fact.h libc3/set__fact.c libc3/set_cursor__fact.h libc3/compare.h libc3/buf_save.h libc3/env.c libc3/env.h libc3/c_types.h libc3/call.c libc3/call.h libc3/log.c libc3/array.h libc3/error.c libc3/error.h libc3/error_handler.c libc3/error_handler.h libc3/io.c libc3/io.h libc3/fact.h libc3/character.c libc3/array.c libc3/facts.h libc3/facts_cursor.c libc3/facts_cursor.h libc3/facts_spec.c libc3/facts_spec.h libc3/facts_spec_cursor.c libc3/facts_spec_cursor.h libc3/character.h libc3/set_cursor__fact.c libc3/facts_with.c libc3/facts_with.h libc3/facts_with_cursor.c libc3/facts_with_cursor.h libc3/fn.c libc3/fn.h libc3/frame.c libc3/frame.h libc3/hash.c libc3/hash.h libc3/ident.c libc3/ident.h libc3/abs.h libc3/integer.c libc3/integer.h libc3/list.c libc3/list.h libc3/module.h libc3/quote.c libc3/quote.h libc3/types.h libc3/eval.h libc3/cfn.c libc3/sign.h libc3/set.c.in libc3/set.h.in libc3/set_cursor.c.in libc3/set_cursor.h.in libc3/str.c libc3/eval.c libc3/buf_inspect.h libc3/ceiling.h libc3/ceiling.c libc3/set_item.c.in libc3/set_item.h.in libc3/fact.c libc3/skiplist.c.in libc3/operator.c libc3/operator.h libc3/buf_parse.c libc3/abs.c libc3/skiplist.h.in libc3/skiplist_node.c.in libc3/skiplist_node.h.in libc3/str.h libc3/sym.c libc3/sym.h libc3/c3.h libc3/facts.c libc3/buf_inspect.c libc3/buf_parse.h libc3/tuple.c libc3/tuple.h libc3/ucd.c libc3/ucd.h libc3/c3.c libc3/tag.h libc3/module.c libc3/tag.c libc3/compare.c libc3/cfn.h libc3/sign.c libc3/sha1.h test/bool_test.c test/buf_file_test.c test/buf_inspect_test.c test/buf_parse_test.c test/buf_test.c test/call_test.c test/character_test.c test/hash_test.c test/fact_test.c test/fact_test.h test/facts_cursor_test.c test/facts_test.c test/facts_with_test.c test/ident_test.c test/env_test.c test/libc3_test.c test/tuple_test.c test/list_test.c test/set__fact_test.c test/set__tag_test.c test/compare_test.h test/skiplist__fact_test.c test/str_test.c test/cfn_test.c test/test.c test/test.h test/sym_test.c test/tag_test.c test/tag_test.h test/types_test.c test/compare_test.c ucd2c/ucd.h ucd2c/ucd2c.c '
diff --git a/test/buf_parse_test.c b/test/buf_parse_test.c
index 13534d1..a3fb433 100644
--- a/test/buf_parse_test.c
+++ b/test/buf_parse_test.c
@@ -1529,6 +1529,10 @@ void buf_parse_test_s16 ()
BUF_PARSE_TEST_S(16, "0127", 127);
BUF_PARSE_TEST_S(16, "128", 128);
BUF_PARSE_TEST_S(16, "0128", 128);
+ BUF_PARSE_TEST_S(16, "255", 255);
+ BUF_PARSE_TEST_S(16, "0255", 255);
+ BUF_PARSE_TEST_S(16, "256", 256);
+ BUF_PARSE_TEST_S(16, "0256", 256);
BUF_PARSE_TEST_S(16, "32767", 32767);
BUF_PARSE_TEST_S(16, "032767", 32767);
}
@@ -1555,10 +1559,14 @@ void buf_parse_test_s32 ()
BUF_PARSE_TEST_S(32, "-0b0111111111111111", -32767);
BUF_PARSE_TEST_S(32, "-0b1000000000000000", -32768);
BUF_PARSE_TEST_S(32, "-0b01000000000000000", -32768);
- BUF_PARSE_TEST_S(32, "-0b1111111111111111111111111111111", -2147483647);
- BUF_PARSE_TEST_S(32, "-0b01111111111111111111111111111111", -2147483647);
- BUF_PARSE_TEST_S(32, "-0b10000000000000000000000000000000", -2147483648);
- BUF_PARSE_TEST_S(32, "-0b010000000000000000000000000000000", -2147483648);
+ BUF_PARSE_TEST_S(32, "-0b1111111111111111111111111111111",
+ -2147483647);
+ BUF_PARSE_TEST_S(32, "-0b01111111111111111111111111111111",
+ -2147483647);
+ BUF_PARSE_TEST_S(32, "-0b10000000000000000000000000000000",
+ -2147483648);
+ BUF_PARSE_TEST_S(32, "-0b010000000000000000000000000000000",
+ -2147483648);
BUF_PARSE_TEST_S(32, "-0o0", 0);
BUF_PARSE_TEST_S(32, "-0o1", -1);
BUF_PARSE_TEST_S(32, "-0o2", -2);
@@ -1694,7 +1702,8 @@ void buf_parse_test_s32 ()
BUF_PARSE_TEST_S(32, "0b1000000000000000", 32768);
BUF_PARSE_TEST_S(32, "0b01000000000000000", 32768);
BUF_PARSE_TEST_S(32, "0b1111111111111111111111111111111", 2147483647);
- BUF_PARSE_TEST_S(32, "0b01111111111111111111111111111111", 2147483647);
+ BUF_PARSE_TEST_S(32, "0b01111111111111111111111111111111",
+ 2147483647);
BUF_PARSE_TEST_S(32, "0o0", 0);
BUF_PARSE_TEST_S(32, "0o1", 1);
BUF_PARSE_TEST_S(32, "0o2", 2);
@@ -1805,6 +1814,311 @@ void buf_parse_test_s32 ()
void buf_parse_test_s64 ()
{
+ BUF_PARSE_TEST_S(64, "-0b0", 0);
+ BUF_PARSE_TEST_S(64, "-0b1", -1);
+ BUF_PARSE_TEST_S(64, "-0b00", 0);
+ BUF_PARSE_TEST_S(64, "-0b01", -1);
+ BUF_PARSE_TEST_S(64, "-0b10", -2);
+ BUF_PARSE_TEST_S(64, "-0b11", -3);
+ BUF_PARSE_TEST_S(64, "-0b000", 0);
+ BUF_PARSE_TEST_S(64, "-0b001", -1);
+ BUF_PARSE_TEST_S(64, "-0b010", -2);
+ BUF_PARSE_TEST_S(64, "-0b011", -3);
+ BUF_PARSE_TEST_S(64, "-0b100", -4);
+ BUF_PARSE_TEST_S(64, "-0b101", -5);
+ BUF_PARSE_TEST_S(64, "-0b110", -6);
+ BUF_PARSE_TEST_S(64, "-0b111", -7);
+ BUF_PARSE_TEST_S(64, "-0b10000000", -128);
+ BUF_PARSE_TEST_S(64, "-0b010000000", -128);
+ BUF_PARSE_TEST_S(64, "-0b111111111111111", -32767);
+ BUF_PARSE_TEST_S(64, "-0b0111111111111111", -32767);
+ BUF_PARSE_TEST_S(64, "-0b1000000000000000", -32768);
+ BUF_PARSE_TEST_S(64, "-0b01000000000000000", -32768);
+ BUF_PARSE_TEST_S(64, "-0b1111111111111111111111111111111",
+ -2147483647);
+ BUF_PARSE_TEST_S(64, "-0b01111111111111111111111111111111",
+ -2147483647);
+ BUF_PARSE_TEST_S(64, "-0b10000000000000000000000000000000",
+ -2147483648);
+ BUF_PARSE_TEST_S(64, "-0b010000000000000000000000000000000",
+ -2147483648);
+ BUF_PARSE_TEST_S(64, "-0b11111111111111111111111111111111111111111111"
+ "1111111111111111111",
+ -9223372036854775807);
+ BUF_PARSE_TEST_S(64, "-0b01111111111111111111111111111111111111111111"
+ "11111111111111111111", -9223372036854775807);
+ /* XXX bug in clang signed integer litteral value bounds check */
+ BUF_PARSE_TEST_S(64, "-0b10000000000000000000000000000000000000000000"
+ "00000000000000000000", -9223372036854775807 - 1);
+ BUF_PARSE_TEST_S(64, "-0b01000000000000000000000000000000000000000000"
+ "000000000000000000000", -9223372036854775807 - 1);
+ BUF_PARSE_TEST_S(64, "-0o0", 0);
+ BUF_PARSE_TEST_S(64, "-0o1", -1);
+ BUF_PARSE_TEST_S(64, "-0o2", -2);
+ BUF_PARSE_TEST_S(64, "-0o3", -3);
+ BUF_PARSE_TEST_S(64, "-0o4", -4);
+ BUF_PARSE_TEST_S(64, "-0o5", -5);
+ BUF_PARSE_TEST_S(64, "-0o6", -6);
+ BUF_PARSE_TEST_S(64, "-0o7", -7);
+ BUF_PARSE_TEST_S(64, "-0o00", 0);
+ BUF_PARSE_TEST_S(64, "-0o01", -1);
+ BUF_PARSE_TEST_S(64, "-0o10", -8);
+ BUF_PARSE_TEST_S(64, "-0o11", -9);
+ BUF_PARSE_TEST_S(64, "-0o000", 0);
+ BUF_PARSE_TEST_S(64, "-0o177", -127);
+ BUF_PARSE_TEST_S(64, "-0o0177", -127);
+ BUF_PARSE_TEST_S(64, "-0o200", -128);
+ BUF_PARSE_TEST_S(64, "-0o0200", -128);
+ BUF_PARSE_TEST_S(64, "-0o77777", -32767);
+ BUF_PARSE_TEST_S(64, "-0o077777", -32767);
+ BUF_PARSE_TEST_S(64, "-0o100000", -32768);
+ BUF_PARSE_TEST_S(64, "-0o0100000", -32768);
+ BUF_PARSE_TEST_S(64, "-0o17777777777", -2147483647);
+ BUF_PARSE_TEST_S(64, "-0o017777777777", -2147483647);
+ BUF_PARSE_TEST_S(64, "-0o20000000000", -2147483648);
+ BUF_PARSE_TEST_S(64, "-0o020000000000", -2147483648);
+ BUF_PARSE_TEST_S(64, "-0o777777777777777777777",
+ -9223372036854775807);
+ BUF_PARSE_TEST_S(64, "-0o0777777777777777777777",
+ -9223372036854775807);
+ /* XXX bug in clang signed integer litteral value bounds checking */
+ BUF_PARSE_TEST_S(64, "-0o1000000000000000000000",
+ -9223372036854775807 - 1);
+ BUF_PARSE_TEST_S(64, "-0o01000000000000000000000",
+ -9223372036854775807 - 1);
+ BUF_PARSE_TEST_S(64, "-0x0", 0);
+ BUF_PARSE_TEST_S(64, "-0x1", -1);
+ BUF_PARSE_TEST_S(64, "-0x2", -2);
+ BUF_PARSE_TEST_S(64, "-0x3", -3);
+ BUF_PARSE_TEST_S(64, "-0x4", -4);
+ BUF_PARSE_TEST_S(64, "-0x5", -5);
+ BUF_PARSE_TEST_S(64, "-0x6", -6);
+ BUF_PARSE_TEST_S(64, "-0x7", -7);
+ BUF_PARSE_TEST_S(64, "-0x8", -8);
+ BUF_PARSE_TEST_S(64, "-0x9", -9);
+ BUF_PARSE_TEST_S(64, "-0xa", -10);
+ BUF_PARSE_TEST_S(64, "-0xA", -10);
+ BUF_PARSE_TEST_S(64, "-0xb", -11);
+ BUF_PARSE_TEST_S(64, "-0xB", -11);
+ BUF_PARSE_TEST_S(64, "-0xc", -12);
+ BUF_PARSE_TEST_S(64, "-0xC", -12);
+ BUF_PARSE_TEST_S(64, "-0xd", -13);
+ BUF_PARSE_TEST_S(64, "-0xD", -13);
+ BUF_PARSE_TEST_S(64, "-0xe", -14);
+ BUF_PARSE_TEST_S(64, "-0xE", -14);
+ BUF_PARSE_TEST_S(64, "-0xf", -15);
+ BUF_PARSE_TEST_S(64, "-0xF", -15);
+ BUF_PARSE_TEST_S(64, "-0x00", 0);
+ BUF_PARSE_TEST_S(64, "-0x01", -1);
+ BUF_PARSE_TEST_S(64, "-0x10", -16);
+ BUF_PARSE_TEST_S(64, "-0x11", -17);
+ BUF_PARSE_TEST_S(64, "-0x000", 0);
+ BUF_PARSE_TEST_S(64, "-0x7f", -127);
+ BUF_PARSE_TEST_S(64, "-0x7F", -127);
+ BUF_PARSE_TEST_S(64, "-0x07f", -127);
+ BUF_PARSE_TEST_S(64, "-0x07F", -127);
+ BUF_PARSE_TEST_S(64, "-0x80", -128);
+ BUF_PARSE_TEST_S(64, "-0x080", -128);
+ BUF_PARSE_TEST_S(64, "-0xff", -255);
+ BUF_PARSE_TEST_S(64, "-0xFF", -255);
+ BUF_PARSE_TEST_S(64, "-0x0ff", -255);
+ BUF_PARSE_TEST_S(64, "-0x0FF", -255);
+ BUF_PARSE_TEST_S(64, "-0x100", -256);
+ BUF_PARSE_TEST_S(64, "-0x0100", -256);
+ BUF_PARSE_TEST_S(64, "-0x7fff", -32767);
+ BUF_PARSE_TEST_S(64, "-0x7FFF", -32767);
+ BUF_PARSE_TEST_S(64, "-0x07fff", -32767);
+ BUF_PARSE_TEST_S(64, "-0x07FFF", -32767);
+ BUF_PARSE_TEST_S(64, "-0x8000", -32768);
+ BUF_PARSE_TEST_S(64, "-0x08000", -32768);
+ BUF_PARSE_TEST_S(64, "-0x7fffffff", -2147483647);
+ BUF_PARSE_TEST_S(64, "-0x7FFFFFFF", -2147483647);
+ BUF_PARSE_TEST_S(64, "-0x07fffffff", -2147483647);
+ BUF_PARSE_TEST_S(64, "-0x07FFFFFFF", -2147483647);
+ BUF_PARSE_TEST_S(64, "-0x80000000", -2147483648);
+ BUF_PARSE_TEST_S(64, "-0x080000000", -2147483648);
+ BUF_PARSE_TEST_S(64, "-0x7fffffffffffffff", -9223372036854775807);
+ BUF_PARSE_TEST_S(64, "-0x7FFFFFFFFFFFFFFF", -9223372036854775807);
+ BUF_PARSE_TEST_S(64, "-0x07fffffffffffffff", -9223372036854775807);
+ BUF_PARSE_TEST_S(64, "-0x07FFFFFFFFFFFFFFF", -9223372036854775807);
+ /* XXX bug in clang signed integer litteral value bounds checking */
+ BUF_PARSE_TEST_S(64, "-0x8000000000000000", -9223372036854775807 - 1);
+ BUF_PARSE_TEST_S(64, "-0x08000000000000000",
+ -9223372036854775807 - 1);
+ BUF_PARSE_TEST_S(64, "-0", 0);
+ BUF_PARSE_TEST_S(64, "-1", -1);
+ BUF_PARSE_TEST_S(64, "-2", -2);
+ BUF_PARSE_TEST_S(64, "-3", -3);
+ BUF_PARSE_TEST_S(64, "-4", -4);
+ BUF_PARSE_TEST_S(64, "-5", -5);
+ BUF_PARSE_TEST_S(64, "-6", -6);
+ BUF_PARSE_TEST_S(64, "-7", -7);
+ BUF_PARSE_TEST_S(64, "-8", -8);
+ BUF_PARSE_TEST_S(64, "-9", -9);
+ BUF_PARSE_TEST_S(64, "-00", 0);
+ BUF_PARSE_TEST_S(64, "-10", -10);
+ BUF_PARSE_TEST_S(64, "-11", -11);
+ BUF_PARSE_TEST_S(64, "-12", -12);
+ BUF_PARSE_TEST_S(64, "-20", -20);
+ BUF_PARSE_TEST_S(64, "-21", -21);
+ BUF_PARSE_TEST_S(64, "-22", -22);
+ BUF_PARSE_TEST_S(64, "-000", 0);
+ BUF_PARSE_TEST_S(64, "-010", -10);
+ BUF_PARSE_TEST_S(64, "-011", -11);
+ BUF_PARSE_TEST_S(64, "-012", -12);
+ BUF_PARSE_TEST_S(64, "-020", -20);
+ BUF_PARSE_TEST_S(64, "-021", -21);
+ BUF_PARSE_TEST_S(64, "-022", -22);
+ BUF_PARSE_TEST_S(64, "-127", -127);
+ BUF_PARSE_TEST_S(64, "-0127", -127);
+ BUF_PARSE_TEST_S(64, "-128", -128);
+ BUF_PARSE_TEST_S(64, "-0128", -128);
+ BUF_PARSE_TEST_S(64, "-32767", -32767);
+ BUF_PARSE_TEST_S(64, "-032767", -32767);
+ BUF_PARSE_TEST_S(64, "-32768", -32768);
+ BUF_PARSE_TEST_S(64, "-032768", -32768);
+ BUF_PARSE_TEST_S(64, "-2147483647", -2147483647);
+ BUF_PARSE_TEST_S(64, "-02147483647", -2147483647);
+ BUF_PARSE_TEST_S(64, "-2147483648", -2147483648);
+ BUF_PARSE_TEST_S(64, "-02147483648", -2147483648);
+ BUF_PARSE_TEST_S(64, "-9223372036854775807", -9223372036854775807);
+ BUF_PARSE_TEST_S(64, "-09223372036854775807", -9223372036854775807);
+ /* XXX bug in clang signed integer litteral value bounds checking */
+ BUF_PARSE_TEST_S(64, "-9223372036854775808",
+ -9223372036854775807 - 1);
+ BUF_PARSE_TEST_S(64, "-09223372036854775808",
+ -9223372036854775807 - 1);
+ BUF_PARSE_TEST_S(64, "0b0", 0);
+ BUF_PARSE_TEST_S(64, "0b1", 1);
+ BUF_PARSE_TEST_S(64, "0b00", 0);
+ BUF_PARSE_TEST_S(64, "0b01", 1);
+ BUF_PARSE_TEST_S(64, "0b10", 2);
+ BUF_PARSE_TEST_S(64, "0b11", 3);
+ BUF_PARSE_TEST_S(64, "0b000", 0);
+ BUF_PARSE_TEST_S(64, "0b001", 1);
+ BUF_PARSE_TEST_S(64, "0b010", 2);
+ BUF_PARSE_TEST_S(64, "0b011", 3);
+ BUF_PARSE_TEST_S(64, "0b100", 4);
+ BUF_PARSE_TEST_S(64, "0b101", 5);
+ BUF_PARSE_TEST_S(64, "0b110", 6);
+ BUF_PARSE_TEST_S(64, "0b111", 7);
+ BUF_PARSE_TEST_S(64, "0b1111111", 127);
+ BUF_PARSE_TEST_S(64, "0b01111111", 127);
+ BUF_PARSE_TEST_S(64, "0b10000000", 128);
+ BUF_PARSE_TEST_S(64, "0b010000000", 128);
+ BUF_PARSE_TEST_S(64, "0b111111111111111", 32767);
+ BUF_PARSE_TEST_S(64, "0b0111111111111111", 32767);
+ BUF_PARSE_TEST_S(64, "0b1000000000000000", 32768);
+ BUF_PARSE_TEST_S(64, "0b01000000000000000", 32768);
+ BUF_PARSE_TEST_S(64, "0b1111111111111111111111111111111", 2147483647);
+ BUF_PARSE_TEST_S(64, "0b01111111111111111111111111111111",
+ 2147483647);
+ BUF_PARSE_TEST_S(64, "0o0", 0);
+ BUF_PARSE_TEST_S(64, "0o1", 1);
+ BUF_PARSE_TEST_S(64, "0o2", 2);
+ BUF_PARSE_TEST_S(64, "0o3", 3);
+ BUF_PARSE_TEST_S(64, "0o4", 4);
+ BUF_PARSE_TEST_S(64, "0o5", 5);
+ BUF_PARSE_TEST_S(64, "0o6", 6);
+ BUF_PARSE_TEST_S(64, "0o7", 7);
+ BUF_PARSE_TEST_S(64, "0o00", 0);
+ BUF_PARSE_TEST_S(64, "0o01", 1);
+ BUF_PARSE_TEST_S(64, "0o10", 8);
+ BUF_PARSE_TEST_S(64, "0o11", 9);
+ BUF_PARSE_TEST_S(64, "0o000", 0);
+ BUF_PARSE_TEST_S(64, "0o177", 127);
+ BUF_PARSE_TEST_S(64, "0o0177", 127);
+ BUF_PARSE_TEST_S(64, "0o200", 128);
+ BUF_PARSE_TEST_S(64, "0o0200", 128);
+ BUF_PARSE_TEST_S(64, "0o77777", 32767);
+ BUF_PARSE_TEST_S(64, "0o077777", 32767);
+ BUF_PARSE_TEST_S(64, "0o100000", 32768);
+ BUF_PARSE_TEST_S(64, "0o0100000", 32768);
+ BUF_PARSE_TEST_S(64, "0o17777777777", 2147483647);
+ BUF_PARSE_TEST_S(64, "0o017777777777", 2147483647);
+ BUF_PARSE_TEST_S(64, "0x0", 0);
+ BUF_PARSE_TEST_S(64, "0x1", 1);
+ BUF_PARSE_TEST_S(64, "0x2", 2);
+ BUF_PARSE_TEST_S(64, "0x3", 3);
+ BUF_PARSE_TEST_S(64, "0x4", 4);
+ BUF_PARSE_TEST_S(64, "0x5", 5);
+ BUF_PARSE_TEST_S(64, "0x6", 6);
+ BUF_PARSE_TEST_S(64, "0x7", 7);
+ BUF_PARSE_TEST_S(64, "0x8", 8);
+ BUF_PARSE_TEST_S(64, "0x9", 9);
+ BUF_PARSE_TEST_S(64, "0xa", 10);
+ BUF_PARSE_TEST_S(64, "0xA", 10);
+ BUF_PARSE_TEST_S(64, "0xb", 11);
+ BUF_PARSE_TEST_S(64, "0xB", 11);
+ BUF_PARSE_TEST_S(64, "0xc", 12);
+ BUF_PARSE_TEST_S(64, "0xC", 12);
+ BUF_PARSE_TEST_S(64, "0xd", 13);
+ BUF_PARSE_TEST_S(64, "0xD", 13);
+ BUF_PARSE_TEST_S(64, "0xe", 14);
+ BUF_PARSE_TEST_S(64, "0xE", 14);
+ BUF_PARSE_TEST_S(64, "0xf", 15);
+ BUF_PARSE_TEST_S(64, "0xF", 15);
+ BUF_PARSE_TEST_S(64, "0x00", 0);
+ BUF_PARSE_TEST_S(64, "0x01", 1);
+ BUF_PARSE_TEST_S(64, "0x10", 16);
+ BUF_PARSE_TEST_S(64, "0x11", 17);
+ BUF_PARSE_TEST_S(64, "0x000", 0);
+ BUF_PARSE_TEST_S(64, "0x7f", 127);
+ BUF_PARSE_TEST_S(64, "0x7F", 127);
+ BUF_PARSE_TEST_S(64, "0x07f", 127);
+ BUF_PARSE_TEST_S(64, "0x07F", 127);
+ BUF_PARSE_TEST_S(64, "0x80", 128);
+ BUF_PARSE_TEST_S(64, "0x080", 128);
+ BUF_PARSE_TEST_S(64, "0xff", 255);
+ BUF_PARSE_TEST_S(64, "0xFF", 255);
+ BUF_PARSE_TEST_S(64, "0x0ff", 255);
+ BUF_PARSE_TEST_S(64, "0x0FF", 255);
+ BUF_PARSE_TEST_S(64, "0x100", 256);
+ BUF_PARSE_TEST_S(64, "0x0100", 256);
+ BUF_PARSE_TEST_S(64, "0x7fff", 32767);
+ BUF_PARSE_TEST_S(64, "0x7FFF", 32767);
+ BUF_PARSE_TEST_S(64, "0x07fff", 32767);
+ BUF_PARSE_TEST_S(64, "0x07FFF", 32767);
+ BUF_PARSE_TEST_S(64, "0x8000", 32768);
+ BUF_PARSE_TEST_S(64, "0x08000", 32768);
+ BUF_PARSE_TEST_S(64, "0x7fffffff", 2147483647);
+ BUF_PARSE_TEST_S(64, "0x7FFFFFFF", 2147483647);
+ BUF_PARSE_TEST_S(64, "0x07fffffff", 2147483647);
+ BUF_PARSE_TEST_S(64, "0x07FFFFFFF", 2147483647);
+ BUF_PARSE_TEST_S(64, "0", 0);
+ BUF_PARSE_TEST_S(64, "1", 1);
+ BUF_PARSE_TEST_S(64, "2", 2);
+ BUF_PARSE_TEST_S(64, "3", 3);
+ BUF_PARSE_TEST_S(64, "4", 4);
+ BUF_PARSE_TEST_S(64, "5", 5);
+ BUF_PARSE_TEST_S(64, "6", 6);
+ BUF_PARSE_TEST_S(64, "7", 7);
+ BUF_PARSE_TEST_S(64, "8", 8);
+ BUF_PARSE_TEST_S(64, "9", 9);
+ BUF_PARSE_TEST_S(64, "00", 0);
+ BUF_PARSE_TEST_S(64, "10", 10);
+ BUF_PARSE_TEST_S(64, "11", 11);
+ BUF_PARSE_TEST_S(64, "12", 12);
+ BUF_PARSE_TEST_S(64, "20", 20);
+ BUF_PARSE_TEST_S(64, "21", 21);
+ BUF_PARSE_TEST_S(64, "22", 22);
+ BUF_PARSE_TEST_S(64, "000", 0);
+ BUF_PARSE_TEST_S(64, "010", 10);
+ BUF_PARSE_TEST_S(64, "011", 11);
+ BUF_PARSE_TEST_S(64, "012", 12);
+ BUF_PARSE_TEST_S(64, "020", 20);
+ BUF_PARSE_TEST_S(64, "021", 21);
+ BUF_PARSE_TEST_S(64, "022", 22);
+ BUF_PARSE_TEST_S(64, "127", 127);
+ BUF_PARSE_TEST_S(64, "0127", 127);
+ BUF_PARSE_TEST_S(64, "128", 128);
+ BUF_PARSE_TEST_S(64, "0128", 128);
+ BUF_PARSE_TEST_S(64, "32767", 32767);
+ BUF_PARSE_TEST_S(64, "032767", 32767);
+ BUF_PARSE_TEST_S(64, "32768", 32768);
+ BUF_PARSE_TEST_S(64, "032768", 32768);
+ BUF_PARSE_TEST_S(64, "2147483647", 2147483647);
+ BUF_PARSE_TEST_S(64, "2147483647", 2147483647);
}
void buf_parse_test_sw ()
@@ -2225,10 +2539,277 @@ void buf_parse_test_u8 ()
void buf_parse_test_u16 ()
{
+ BUF_PARSE_TEST_U(16, "0b0", 0);
+ BUF_PARSE_TEST_U(16, "0b1", 1);
+ BUF_PARSE_TEST_U(16, "0b00", 0);
+ BUF_PARSE_TEST_U(16, "0b01", 1);
+ BUF_PARSE_TEST_U(16, "0b10", 2);
+ BUF_PARSE_TEST_U(16, "0b11", 3);
+ BUF_PARSE_TEST_U(16, "0b000", 0);
+ BUF_PARSE_TEST_U(16, "0b001", 1);
+ BUF_PARSE_TEST_U(16, "0b010", 2);
+ BUF_PARSE_TEST_U(16, "0b011", 3);
+ BUF_PARSE_TEST_U(16, "0b100", 4);
+ BUF_PARSE_TEST_U(16, "0b101", 5);
+ BUF_PARSE_TEST_U(16, "0b110", 6);
+ BUF_PARSE_TEST_U(16, "0b111", 7);
+ BUF_PARSE_TEST_U(16, "0b1000000", 64);
+ BUF_PARSE_TEST_U(16, "0b01000000", 64);
+ BUF_PARSE_TEST_U(16, "0b1111111", 127);
+ BUF_PARSE_TEST_U(16, "0b01111111", 127);
+ BUF_PARSE_TEST_U(16, "0b10000000", 128);
+ BUF_PARSE_TEST_U(16, "0b010000000", 128);
+ BUF_PARSE_TEST_U(16, "0b111111111111111", 32767);
+ BUF_PARSE_TEST_U(16, "0b0111111111111111", 32767);
+ BUF_PARSE_TEST_U(16, "0b1000000000000000", 32768);
+ BUF_PARSE_TEST_U(16, "0b01000000000000000", 32768);
+ BUF_PARSE_TEST_U(16, "0b1111111111111111", 65535);
+ BUF_PARSE_TEST_U(16, "0b01111111111111111", 65535);
+ BUF_PARSE_TEST_U(16, "0o0", 0);
+ BUF_PARSE_TEST_U(16, "0o1", 1);
+ BUF_PARSE_TEST_U(16, "0o2", 2);
+ BUF_PARSE_TEST_U(16, "0o3", 3);
+ BUF_PARSE_TEST_U(16, "0o4", 4);
+ BUF_PARSE_TEST_U(16, "0o5", 5);
+ BUF_PARSE_TEST_U(16, "0o6", 6);
+ BUF_PARSE_TEST_U(16, "0o7", 7);
+ BUF_PARSE_TEST_U(16, "0o00", 0);
+ BUF_PARSE_TEST_U(16, "0o01", 1);
+ BUF_PARSE_TEST_U(16, "0o10", 8);
+ BUF_PARSE_TEST_U(16, "0o11", 9);
+ BUF_PARSE_TEST_U(16, "0o000", 0);
+ BUF_PARSE_TEST_U(16, "0o177", 127);
+ BUF_PARSE_TEST_U(16, "0o0177", 127);
+ BUF_PARSE_TEST_U(16, "0o200", 128);
+ BUF_PARSE_TEST_U(16, "0o0200", 128);
+ BUF_PARSE_TEST_U(16, "0o77777", 32767);
+ BUF_PARSE_TEST_U(16, "0o077777", 32767);
+ BUF_PARSE_TEST_U(16, "0o100000", 32768);
+ BUF_PARSE_TEST_U(16, "0o0100000", 32768);
+ BUF_PARSE_TEST_U(16, "0o177777", 65535);
+ BUF_PARSE_TEST_U(16, "0o0177777", 65535);
+ BUF_PARSE_TEST_U(16, "0x0", 0);
+ BUF_PARSE_TEST_U(16, "0x1", 1);
+ BUF_PARSE_TEST_U(16, "0x2", 2);
+ BUF_PARSE_TEST_U(16, "0x3", 3);
+ BUF_PARSE_TEST_U(16, "0x4", 4);
+ BUF_PARSE_TEST_U(16, "0x5", 5);
+ BUF_PARSE_TEST_U(16, "0x6", 6);
+ BUF_PARSE_TEST_U(16, "0x7", 7);
+ BUF_PARSE_TEST_U(16, "0x8", 8);
+ BUF_PARSE_TEST_U(16, "0x9", 9);
+ BUF_PARSE_TEST_U(16, "0xa", 10);
+ BUF_PARSE_TEST_U(16, "0xA", 10);
+ BUF_PARSE_TEST_U(16, "0xb", 11);
+ BUF_PARSE_TEST_U(16, "0xB", 11);
+ BUF_PARSE_TEST_U(16, "0xc", 12);
+ BUF_PARSE_TEST_U(16, "0xC", 12);
+ BUF_PARSE_TEST_U(16, "0xd", 13);
+ BUF_PARSE_TEST_U(16, "0xD", 13);
+ BUF_PARSE_TEST_U(16, "0xe", 14);
+ BUF_PARSE_TEST_U(16, "0xE", 14);
+ BUF_PARSE_TEST_U(16, "0xf", 15);
+ BUF_PARSE_TEST_U(16, "0xF", 15);
+ BUF_PARSE_TEST_U(16, "0x00", 0);
+ BUF_PARSE_TEST_U(16, "0x01", 1);
+ BUF_PARSE_TEST_U(16, "0x10", 16);
+ BUF_PARSE_TEST_U(16, "0x11", 17);
+ BUF_PARSE_TEST_U(16, "0x000", 0);
+ BUF_PARSE_TEST_U(16, "0x7f", 127);
+ BUF_PARSE_TEST_U(16, "0x7F", 127);
+ BUF_PARSE_TEST_U(16, "0x07f", 127);
+ BUF_PARSE_TEST_U(16, "0x07F", 127);
+ BUF_PARSE_TEST_U(16, "0x80", 128);
+ BUF_PARSE_TEST_U(16, "0x080", 128);
+ BUF_PARSE_TEST_U(16, "0xff", 255);
+ BUF_PARSE_TEST_U(16, "0xFF", 255);
+ BUF_PARSE_TEST_U(16, "0x0ff", 255);
+ BUF_PARSE_TEST_U(16, "0x0FF", 255);
+ BUF_PARSE_TEST_U(16, "0x100", 256);
+ BUF_PARSE_TEST_U(16, "0x0100", 256);
+ BUF_PARSE_TEST_U(16, "0x7fff", 32767);
+ BUF_PARSE_TEST_U(16, "0x7FFF", 32767);
+ BUF_PARSE_TEST_U(16, "0x07fff", 32767);
+ BUF_PARSE_TEST_U(16, "0x07FFF", 32767);
+ BUF_PARSE_TEST_U(16, "0x8000", 32768);
+ BUF_PARSE_TEST_U(16, "0x08000", 32768);
+ BUF_PARSE_TEST_U(16, "0xffff", 65535);
+ BUF_PARSE_TEST_U(16, "0xFFFF", 65535);
+ BUF_PARSE_TEST_U(16, "0x0ffff", 65535);
+ BUF_PARSE_TEST_U(16, "0x0FFFF", 65535);
+ BUF_PARSE_TEST_U(16, "0", 0);
+ BUF_PARSE_TEST_U(16, "1", 1);
+ BUF_PARSE_TEST_U(16, "2", 2);
+ BUF_PARSE_TEST_U(16, "3", 3);
+ BUF_PARSE_TEST_U(16, "4", 4);
+ BUF_PARSE_TEST_U(16, "5", 5);
+ BUF_PARSE_TEST_U(16, "6", 6);
+ BUF_PARSE_TEST_U(16, "7", 7);
+ BUF_PARSE_TEST_U(16, "8", 8);
+ BUF_PARSE_TEST_U(16, "9", 9);
+ BUF_PARSE_TEST_U(16, "00", 0);
+ BUF_PARSE_TEST_U(16, "10", 10);
+ BUF_PARSE_TEST_U(16, "11", 11);
+ BUF_PARSE_TEST_U(16, "12", 12);
+ BUF_PARSE_TEST_U(16, "20", 20);
+ BUF_PARSE_TEST_U(16, "21", 21);
+ BUF_PARSE_TEST_U(16, "22", 22);
+ BUF_PARSE_TEST_U(16, "000", 0);
+ BUF_PARSE_TEST_U(16, "010", 10);
+ BUF_PARSE_TEST_U(16, "011", 11);
+ BUF_PARSE_TEST_U(16, "012", 12);
+ BUF_PARSE_TEST_U(16, "020", 20);
+ BUF_PARSE_TEST_U(16, "021", 21);
+ BUF_PARSE_TEST_U(16, "022", 22);
+ BUF_PARSE_TEST_U(16, "127", 127);
+ BUF_PARSE_TEST_U(16, "0127", 127);
+ BUF_PARSE_TEST_U(16, "128", 128);
+ BUF_PARSE_TEST_U(16, "0128", 128);
+ BUF_PARSE_TEST_U(16, "255", 255);
+ BUF_PARSE_TEST_U(16, "0255", 255);
+ BUF_PARSE_TEST_U(16, "256", 256);
+ BUF_PARSE_TEST_U(16, "0256", 256);
+ BUF_PARSE_TEST_U(16, "32767", 32767);
+ BUF_PARSE_TEST_U(16, "032767", 32767);
+ BUF_PARSE_TEST_U(16, "32768", 32768);
+ BUF_PARSE_TEST_U(16, "032768", 32768);
+ BUF_PARSE_TEST_U(16, "65535", 65535);
+ BUF_PARSE_TEST_U(16, "065535", 65535);
}
void buf_parse_test_u32 ()
{
+ BUF_PARSE_TEST_U(32, "0b0", 0);
+ BUF_PARSE_TEST_U(32, "0b1", 1);
+ BUF_PARSE_TEST_U(32, "0b00", 0);
+ BUF_PARSE_TEST_U(32, "0b01", 1);
+ BUF_PARSE_TEST_U(32, "0b10", 2);
+ BUF_PARSE_TEST_U(32, "0b11", 3);
+ BUF_PARSE_TEST_U(32, "0b000", 0);
+ BUF_PARSE_TEST_U(32, "0b001", 1);
+ BUF_PARSE_TEST_U(32, "0b010", 2);
+ BUF_PARSE_TEST_U(32, "0b011", 3);
+ BUF_PARSE_TEST_U(32, "0b100", 4);
+ BUF_PARSE_TEST_U(32, "0b101", 5);
+ BUF_PARSE_TEST_U(32, "0b110", 6);
+ BUF_PARSE_TEST_U(32, "0b111", 7);
+ BUF_PARSE_TEST_U(32, "0b1111111", 127);
+ BUF_PARSE_TEST_U(32, "0b01111111", 127);
+ BUF_PARSE_TEST_U(32, "0b10000000", 128);
+ BUF_PARSE_TEST_U(32, "0b010000000", 128);
+ BUF_PARSE_TEST_U(32, "0b111111111111111", 32767);
+ BUF_PARSE_TEST_U(32, "0b0111111111111111", 32767);
+ BUF_PARSE_TEST_U(32, "0b1000000000000000", 32768);
+ BUF_PARSE_TEST_U(32, "0b01000000000000000", 32768);
+ BUF_PARSE_TEST_U(32, "0b1111111111111111111111111111111", 2147483647);
+ BUF_PARSE_TEST_U(32, "0b01111111111111111111111111111111",
+ 2147483647);
+ BUF_PARSE_TEST_U(32, "0o0", 0);
+ BUF_PARSE_TEST_U(32, "0o1", 1);
+ BUF_PARSE_TEST_U(32, "0o2", 2);
+ BUF_PARSE_TEST_U(32, "0o3", 3);
+ BUF_PARSE_TEST_U(32, "0o4", 4);
+ BUF_PARSE_TEST_U(32, "0o5", 5);
+ BUF_PARSE_TEST_U(32, "0o6", 6);
+ BUF_PARSE_TEST_U(32, "0o7", 7);
+ BUF_PARSE_TEST_U(32, "0o00", 0);
+ BUF_PARSE_TEST_U(32, "0o01", 1);
+ BUF_PARSE_TEST_U(32, "0o10", 8);
+ BUF_PARSE_TEST_U(32, "0o11", 9);
+ BUF_PARSE_TEST_U(32, "0o000", 0);
+ BUF_PARSE_TEST_U(32, "0o177", 127);
+ BUF_PARSE_TEST_U(32, "0o0177", 127);
+ BUF_PARSE_TEST_U(32, "0o200", 128);
+ BUF_PARSE_TEST_U(32, "0o0200", 128);
+ BUF_PARSE_TEST_U(32, "0o77777", 32767);
+ BUF_PARSE_TEST_U(32, "0o077777", 32767);
+ BUF_PARSE_TEST_U(32, "0o100000", 32768);
+ BUF_PARSE_TEST_U(32, "0o0100000", 32768);
+ BUF_PARSE_TEST_U(32, "0o17777777777", 2147483647);
+ BUF_PARSE_TEST_U(32, "0o017777777777", 2147483647);
+ BUF_PARSE_TEST_U(32, "0x0", 0);
+ BUF_PARSE_TEST_U(32, "0x1", 1);
+ BUF_PARSE_TEST_U(32, "0x2", 2);
+ BUF_PARSE_TEST_U(32, "0x3", 3);
+ BUF_PARSE_TEST_U(32, "0x4", 4);
+ BUF_PARSE_TEST_U(32, "0x5", 5);
+ BUF_PARSE_TEST_U(32, "0x6", 6);
+ BUF_PARSE_TEST_U(32, "0x7", 7);
+ BUF_PARSE_TEST_U(32, "0x8", 8);
+ BUF_PARSE_TEST_U(32, "0x9", 9);
+ BUF_PARSE_TEST_U(32, "0xa", 10);
+ BUF_PARSE_TEST_U(32, "0xA", 10);
+ BUF_PARSE_TEST_U(32, "0xb", 11);
+ BUF_PARSE_TEST_U(32, "0xB", 11);
+ BUF_PARSE_TEST_U(32, "0xc", 12);
+ BUF_PARSE_TEST_U(32, "0xC", 12);
+ BUF_PARSE_TEST_U(32, "0xd", 13);
+ BUF_PARSE_TEST_U(32, "0xD", 13);
+ BUF_PARSE_TEST_U(32, "0xe", 14);
+ BUF_PARSE_TEST_U(32, "0xE", 14);
+ BUF_PARSE_TEST_U(32, "0xf", 15);
+ BUF_PARSE_TEST_U(32, "0xF", 15);
+ BUF_PARSE_TEST_U(32, "0x00", 0);
+ BUF_PARSE_TEST_U(32, "0x01", 1);
+ BUF_PARSE_TEST_U(32, "0x10", 16);
+ BUF_PARSE_TEST_U(32, "0x11", 17);
+ BUF_PARSE_TEST_U(32, "0x000", 0);
+ BUF_PARSE_TEST_U(32, "0x7f", 127);
+ BUF_PARSE_TEST_U(32, "0x7F", 127);
+ BUF_PARSE_TEST_U(32, "0x07f", 127);
+ BUF_PARSE_TEST_U(32, "0x07F", 127);
+ BUF_PARSE_TEST_U(32, "0x80", 128);
+ BUF_PARSE_TEST_U(32, "0x080", 128);
+ BUF_PARSE_TEST_U(32, "0xff", 255);
+ BUF_PARSE_TEST_U(32, "0xFF", 255);
+ BUF_PARSE_TEST_U(32, "0x0ff", 255);
+ BUF_PARSE_TEST_U(32, "0x0FF", 255);
+ BUF_PARSE_TEST_U(32, "0x100", 256);
+ BUF_PARSE_TEST_U(32, "0x0100", 256);
+ BUF_PARSE_TEST_U(32, "0x7fff", 32767);
+ BUF_PARSE_TEST_U(32, "0x7FFF", 32767);
+ BUF_PARSE_TEST_U(32, "0x07fff", 32767);
+ BUF_PARSE_TEST_U(32, "0x07FFF", 32767);
+ BUF_PARSE_TEST_U(32, "0x8000", 32768);
+ BUF_PARSE_TEST_U(32, "0x08000", 32768);
+ BUF_PARSE_TEST_U(32, "0x7fffffff", 2147483647);
+ BUF_PARSE_TEST_U(32, "0x7FFFFFFF", 2147483647);
+ BUF_PARSE_TEST_U(32, "0x07fffffff", 2147483647);
+ BUF_PARSE_TEST_U(32, "0x07FFFFFFF", 2147483647);
+ BUF_PARSE_TEST_U(32, "0", 0);
+ BUF_PARSE_TEST_U(32, "1", 1);
+ BUF_PARSE_TEST_U(32, "2", 2);
+ BUF_PARSE_TEST_U(32, "3", 3);
+ BUF_PARSE_TEST_U(32, "4", 4);
+ BUF_PARSE_TEST_U(32, "5", 5);
+ BUF_PARSE_TEST_U(32, "6", 6);
+ BUF_PARSE_TEST_U(32, "7", 7);
+ BUF_PARSE_TEST_U(32, "8", 8);
+ BUF_PARSE_TEST_U(32, "9", 9);
+ BUF_PARSE_TEST_U(32, "00", 0);
+ BUF_PARSE_TEST_U(32, "10", 10);
+ BUF_PARSE_TEST_U(32, "11", 11);
+ BUF_PARSE_TEST_U(32, "12", 12);
+ BUF_PARSE_TEST_U(32, "20", 20);
+ BUF_PARSE_TEST_U(32, "21", 21);
+ BUF_PARSE_TEST_U(32, "22", 22);
+ BUF_PARSE_TEST_U(32, "000", 0);
+ BUF_PARSE_TEST_U(32, "010", 10);
+ BUF_PARSE_TEST_U(32, "011", 11);
+ BUF_PARSE_TEST_U(32, "012", 12);
+ BUF_PARSE_TEST_U(32, "020", 20);
+ BUF_PARSE_TEST_U(32, "021", 21);
+ BUF_PARSE_TEST_U(32, "022", 22);
+ BUF_PARSE_TEST_U(32, "127", 127);
+ BUF_PARSE_TEST_U(32, "0127", 127);
+ BUF_PARSE_TEST_U(32, "128", 128);
+ BUF_PARSE_TEST_U(32, "0128", 128);
+ BUF_PARSE_TEST_U(32, "32767", 32767);
+ BUF_PARSE_TEST_U(32, "032767", 32767);
+ BUF_PARSE_TEST_U(32, "32768", 32768);
+ BUF_PARSE_TEST_U(32, "032768", 32768);
+ BUF_PARSE_TEST_U(32, "2147483647", 2147483647);
+ BUF_PARSE_TEST_U(32, "2147483647", 2147483647);
}
void buf_parse_test_u64 ()