authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-04-18 00:05:09-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-04-18 00:05:09-04:00
log407916cd2f3f4931de29fd87b8c9ae3faeba8452
tree5ee194f80ce127d81e220869cd56bb53c1c04f17
parentdef4fbc9ab704b1add5c3af40692b3d26594e58e

rename `@intType` to `@IntType` to follow convention

closes #327

12 files changed, 29 insertions(+), 29 deletions(-)

doc/langref.md+1-1
......@@ -584,7 +584,7 @@ to stderr, and then a newline at the end.
584584This function can be used to do "printf debugging" on compile-time executing
585585code.
586586
587### @intType(comptime is_signed: bool, comptime bit_count: u8) -> type
587### @IntType(comptime is_signed: bool, comptime bit_count: u8) -> type
588588
589589This function returns an integer type with the given signness and bit count.
590590
src/codegen.cpp+1-1
......@@ -4500,7 +4500,7 @@ static void define_builtin_fns(CodeGen *g) {
45004500 create_builtin_fn(g, BuiltinFnIdTruncate, "truncate", 2);
45014501 create_builtin_fn(g, BuiltinFnIdCompileErr, "compileError", 1);
45024502 create_builtin_fn(g, BuiltinFnIdCompileLog, "compileLog", SIZE_MAX);
4503 create_builtin_fn(g, BuiltinFnIdIntType, "intType", 2);
4503 create_builtin_fn(g, BuiltinFnIdIntType, "IntType", 2);
45044504 create_builtin_fn(g, BuiltinFnIdSetDebugSafety, "setDebugSafety", 2);
45054505 create_builtin_fn(g, BuiltinFnIdSetGlobalAlign, "setGlobalAlign", 2);
45064506 create_builtin_fn(g, BuiltinFnIdSetGlobalSection, "setGlobalSection", 2);
src/ir_print.cpp+1-1
......@@ -602,7 +602,7 @@ static void ir_print_truncate(IrPrint *irp, IrInstructionTruncate *instruction)
602602}
603603
604604static void ir_print_int_type(IrPrint *irp, IrInstructionIntType *instruction) {
605 fprintf(irp->f, "@intType(");
605 fprintf(irp->f, "@IntType(");
606606 ir_print_other_instruction(irp, instruction->is_signed);
607607 fprintf(irp->f, ", ");
608608 ir_print_other_instruction(irp, instruction->bit_count);
std/fmt.zig+1-1
......@@ -222,7 +222,7 @@ pub fn formatInt(value: var, base: u8, uppercase: bool, width: usize,
222222fn formatIntSigned(value: var, base: u8, uppercase: bool, width: usize,
223223 context: var, output: fn(@typeOf(context), []const u8)->bool) -> bool
224224{
225 const uint = @intType(false, @typeOf(value).bit_count);
225 const uint = @IntType(false, @typeOf(value).bit_count);
226226 if (value < 0) {
227227 const minus_sign: u8 = '-';
228228 if (!output(context, (&minus_sign)[0...1]))
std/math.zig+1-1
......@@ -62,7 +62,7 @@ pub fn abs(x: var) -> @typeOf(x) {
6262}
6363fn getReturnTypeForAbs(comptime T: type) -> type {
6464 if (@isInteger(T)) {
65 return @intType(false, T.bit_count);
65 return @IntType(false, T.bit_count);
6666 } else {
6767 return T;
6868 }
std/mem.zig+1-1
......@@ -167,7 +167,7 @@ pub fn readInt(bytes: []const u8, comptime T: type, big_endian: bool) -> T {
167167/// to fill the entire buffer provided.
168168/// value must be an integer.
169169pub fn writeInt(buf: []u8, value: var, big_endian: bool) {
170 const uint = @intType(false, @typeOf(value).bit_count);
170 const uint = @IntType(false, @typeOf(value).bit_count);
171171 var bits = @truncate(uint, value);
172172 if (big_endian) {
173173 var index: usize = buf.len;
std/os/child_process.zig+1-1
......@@ -229,7 +229,7 @@ fn forkChildErrReport(fd: i32, err: error) -> noreturn {
229229 posix.exit(1);
230230}
231231
232const ErrInt = @intType(false, @sizeOf(error) * 8);
232const ErrInt = @IntType(false, @sizeOf(error) * 8);
233233fn writeIntFd(fd: i32, value: ErrInt) -> %void {
234234 var bytes: [@sizeOf(ErrInt)]u8 = undefined;
235235 mem.writeInt(bytes[0...], value, true);
std/rand.zig+1-1
......@@ -84,7 +84,7 @@ pub const Rand = struct {
8484 // const mask = ((1 << @float_mantissa_bit_count(T)) - 1);
8585 // const rand_bits = r.rng.scalar(int) & mask;
8686 // return @float_compose(T, false, 0, rand_bits) - 1.0
87 const int_type = @intType(false, @sizeOf(T) * 8);
87 const int_type = @IntType(false, @sizeOf(T) * 8);
8888 const precision = if (T == f32) {
8989 16777216
9090 } else if (T == f64) {
test/cases/math.zig+1-1
......@@ -152,7 +152,7 @@ fn testBinaryNot(x: u16) {
152152}
153153
154154test "smallIntAddition" {
155 var x: @intType(false, 2) = 0;
155 var x: @IntType(false, 2) = 0;
156156 assert(x == 0);
157157
158158 x += 1;
test/cases/misc.zig+13-13
......@@ -19,16 +19,16 @@ test "callDisabledExternFn" {
1919 disabledExternFn();
2020}
2121
22test "intTypeBuiltin" {
23 assert(@intType(true, 8) == i8);
24 assert(@intType(true, 16) == i16);
25 assert(@intType(true, 32) == i32);
26 assert(@intType(true, 64) == i64);
22test "@IntType builtin" {
23 assert(@IntType(true, 8) == i8);
24 assert(@IntType(true, 16) == i16);
25 assert(@IntType(true, 32) == i32);
26 assert(@IntType(true, 64) == i64);
2727
28 assert(@intType(false, 8) == u8);
29 assert(@intType(false, 16) == u16);
30 assert(@intType(false, 32) == u32);
31 assert(@intType(false, 64) == u64);
28 assert(@IntType(false, 8) == u8);
29 assert(@IntType(false, 16) == u16);
30 assert(@IntType(false, 32) == u32);
31 assert(@IntType(false, 64) == u64);
3232
3333 assert(i8.bit_count == 8);
3434 assert(i16.bit_count == 16);
......@@ -48,10 +48,10 @@ test "intTypeBuiltin" {
4848 assert(!usize.is_signed);
4949}
5050
51const u1 = @intType(false, 1);
52const u63 = @intType(false, 63);
53const i1 = @intType(true, 1);
54const i63 = @intType(true, 63);
51const u1 = @IntType(false, 1);
52const u63 = @IntType(false, 63);
53const i1 = @IntType(true, 1);
54const i63 = @IntType(true, 63);
5555
5656test "minValueAndMaxValue" {
5757 assert(@maxValue(u1) == 1);
test/cases/struct.zig+4-4
......@@ -201,8 +201,8 @@ test "packedStruct" {
201201}
202202
203203
204const u2 = @intType(false, 2);
205const u3 = @intType(false, 3);
204const u2 = @IntType(false, 2);
205const u3 = @IntType(false, 3);
206206
207207const BitField1 = packed struct {
208208 a: u3,
......@@ -243,7 +243,7 @@ fn getC(data: &const BitField1) -> u2 {
243243 return data.c;
244244}
245245
246const u24 = @intType(false, 24);
246const u24 = @IntType(false, 24);
247247const Foo24Bits = packed struct {
248248 field: u24,
249249};
......@@ -374,7 +374,7 @@ test "runtime struct initialization of bitfield" {
374374 assert(s2.y == u4(x2));
375375}
376376
377const u4 = @intType(false, 4);
377const u4 = @IntType(false, 4);
378378
379379var x1 = u4(1);
380380var x2 = u8(2);
test/run_tests.cpp+3-3
......@@ -1736,8 +1736,8 @@ fn bar(a: i32, b: []const u8) {
17361736 ".tmp_source.zig:3:17: note: called from here");
17371737
17381738 add_compile_fail_case("casting bit offset pointer to regular pointer", R"SOURCE(
1739const u2 = @intType(false, 2);
1740const u3 = @intType(false, 3);
1739const u2 = @IntType(false, 2);
1740const u3 = @IntType(false, 3);
17411741
17421742const BitField = packed struct {
17431743 a: u3,
......@@ -1869,7 +1869,7 @@ export fn entry(a: &i32) -> usize {
18691869
18701870 add_compile_fail_case("too many error values to cast to small integer", R"SOURCE(
18711871error A; error B; error C; error D; error E; error F; error G; error H;
1872const u2 = @intType(false, 2);
1872const u2 = @IntType(false, 2);
18731873fn foo(e: error) -> u2 {
18741874 return u2(e);
18751875}