| author | |
| committer | |
| log | fdb88708527742e450e4c566024d9d50ce61dd8d |
| tree | 1a35982af5dd47599044afcd1f1e722bcda09fee |
| parent | b45387f20e3abad052a11df55d2cd7bab099e5c3 |
Closes #10793
Co-authored-by: Veikka Tuominen <git@vexu.eu>3 files changed, 7 insertions(+), 1 deletions(-)
lib/std/zig/c_translation.zig+1-1| ... | @@ -268,7 +268,7 @@ test "sizeof" { | ... | @@ -268,7 +268,7 @@ test "sizeof" { |
| 268 | pub const CIntLiteralRadix = enum { decimal, octal, hexadecimal }; | 268 | pub const CIntLiteralRadix = enum { decimal, octal, hexadecimal }; |
| 269 | 269 | ||
| 270 | fn PromoteIntLiteralReturnType(comptime SuffixType: type, comptime number: comptime_int, comptime radix: CIntLiteralRadix) type { | 270 | fn PromoteIntLiteralReturnType(comptime SuffixType: type, comptime number: comptime_int, comptime radix: CIntLiteralRadix) type { |
| 271 | const signed_decimal = [_]type{ c_int, c_long, c_longlong }; | 271 | const signed_decimal = [_]type{ c_int, c_long, c_longlong, c_ulonglong }; |
| 272 | const signed_oct_hex = [_]type{ c_int, c_uint, c_long, c_ulong, c_longlong, c_ulonglong }; | 272 | const signed_oct_hex = [_]type{ c_int, c_uint, c_long, c_ulong, c_longlong, c_ulonglong }; |
| 273 | const unsigned = [_]type{ c_uint, c_ulong, c_ulonglong }; | 273 | const unsigned = [_]type{ c_uint, c_ulong, c_ulonglong }; |
| 274 | 274 |
test/behavior/translate_c_macros.h+2| ... | @@ -48,3 +48,5 @@ typedef _Bool uintptr_t; | ... | @@ -48,3 +48,5 @@ typedef _Bool uintptr_t; |
| 48 | 48 | ||
| 49 | #define CAST_TO_BOOL(X) (_Bool)(X) | 49 | #define CAST_TO_BOOL(X) (_Bool)(X) |
| 50 | #define CAST_TO_UINTPTR(X) (uintptr_t)(X) | 50 | #define CAST_TO_UINTPTR(X) (uintptr_t)(X) |
| 51 | |||
| 52 | #define LARGE_INT 18446744073709550592 |
test/behavior/translate_c_macros.zig+4| ... | @@ -113,3 +113,7 @@ test "cast functions" { | ... | @@ -113,3 +113,7 @@ test "cast functions" { |
| 113 | try expectEqual(true, h.CAST_TO_BOOL(S.foo)); | 113 | try expectEqual(true, h.CAST_TO_BOOL(S.foo)); |
| 114 | try expect(h.CAST_TO_UINTPTR(S.foo) != 0); | 114 | try expect(h.CAST_TO_UINTPTR(S.foo) != 0); |
| 115 | } | 115 | } |
| 116 | |||
| 117 | test "large integer macro" { | ||
| 118 | try expectEqual(@as(c_ulonglong, 18446744073709550592), h.LARGE_INT); | ||
| 119 | } |