summaryrefslogtreecommitdiffstats
path: root/itypes.c
Commit message (Collapse)AuthorAgeFilesLines
* c++ maintenance: eliminate old-style casts.Kaz Kylheku2017-06-061-3/+3
| | | | | | | | | | | | | | | | | | | | Old style casts have crept into the code base. * buf.c (make_buf, buf_grow, buf_get_i8, buf_get_u8): Replace old style cast with macro. * ffi.c (align_sw_get, align_sw_put, ffi_be_i32_get, ffi_be_u32_get, ffi_le_i32_put, ffi_le_i32_get, ffi_le_u32_get, ffi_be_i64_put, ffi_be_i64_get, ffi_be_u64_get, ffi_le_i64_put, ffi_le_i64_get, ffi_le_u64_get, ffi_sbit_put, ffi_sbit_get, ffi_init_extra_types): Likewise. * hash.c (hash_buf): Likewise. * itypes.c (c_i32, c_i64, c_u64): Likewise. * stream.c (stdio_put_buf, stdio_fill_buf): Likewise.
* itypes: fix broken u64_t range check.Kaz Kylheku2017-06-051-2/+2
| | | | | * itypes.c (c_u64): Replace copy and pasted signed check with the unsigned check.
* itypes: avoid out of range literal.Kaz Kylheku2017-06-051-2/+2
| | | | | | | * itypes.c (c_i32): Avoid the troublesome expressions -0x80000000. Instead, cast 0x7FFFFFFF to the cnum type, then invert, and subtract one. (c_i64): Similarly for -0x8000000000000000.
* ffi: bugfix: broken i64 conversion.Kaz Kylheku2017-05-121-1/+1
| | | | | * itypes.c (c_i64): Fix c_num being called on the function pointer num rather than the correct operand n.
* itypes: fix wrong error messages.Kaz Kylheku2017-05-041-5/+5
| | | | | * itypes.c (c_u8, c_u16, c_u32, c_u64, c_uint): Fix messages referring to signed version of type.
* Rename c_uint_ptr_num; introduce cunum typedef.Kaz Kylheku2017-04-211-3/+3
| | | | | | | | | | | | | | | Unsigned version of cnum becomes less verbose. * arith.c (c_uint_ptr_num): Renamed to c_unum. * arith.h (c_uint_ptr_num): Declaration removed. (c_unum): Declared. * itypes.c (c_u32, c_u64, c_uint): Follow rename. * lib.h (ucnum): New typedef. * rand.c (make_random_state): Follow rename.
* Continuing implementation of buffers.Kaz Kylheku2017-04-211-0/+232
* Makefile (OBJS): New objects itypes.o and buf.o. * buf.c, buf.h: New files. * itypes.c, itypes.h: New files. * lib.c (obj_print_impl): Handle BUF via buf_print and buf_pprint. (init): Call itypes_init and buf_init. * parser.h (end_of_buflit): Declared. * parser.l (BUFLIT): New exclusive state. (grammar): New rules for recognizing start of buffer literal and its interior. (end_of_buflit): New function. * parser.y (HASH_B_QUOTE): New token. (buflit, buflit_items, buflit_item): New nonterminals and corresponding grammar rules. (i_expr, n_expr): These symbols now generate a buflit; a buffer literal is a kind of expression. (yybadtoken): Handle HASH_B_QUOTE case.