Skip to content

Commit d5f5626

Browse files
committed
rename isize to int
1 parent 2b2ed66 commit d5f5626

File tree

27 files changed

+66
-66
lines changed

27 files changed

+66
-66
lines changed

lib/c/src/ctypes/mod.ri

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ public alias intmax_t := int64;
2626
public alias uintmax_t := uint64;
2727

2828
public alias size_t := usize;
29-
public alias ptrdiff_t := isize;
30-
public alias intptr_t := isize;
29+
public alias ptrdiff_t := int;
30+
public alias intptr_t := int;
3131
public alias uintptr_t := usize;
32-
public alias ssize_t := isize;
32+
public alias ssize_t := int;
3333

3434
public alias pid_t := int32;
3535
public alias off_t := int64;

lib/c/src/libc/stat.ri

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ public struct Stat {
1717
__pad0: uint32;
1818
public rdev: dev_t;
1919
public size: off_t;
20-
public blksize: isize;
20+
public blksize: int;
2121
public blocks: int64;
2222

2323
public atim: timespec;
2424
public mtim: timespec;
2525
public ctim: timespec;
26-
__unused: [3]isize;
26+
__unused: [3]int;
2727
}
2828
#endif
2929

lib/c/src/libc/stdio.ri

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,5 +115,5 @@ extern (C) {
115115
public func popen(cmd: [&]uint8, modes: [&]uint8) -> ?&mut FILE;
116116
public func pclose(stream: &mut FILE) -> int32;
117117

118-
public func getline(lineptr: &?[&]uint8, n: &usize, stream: &mut FILE) -> isize;
118+
public func getline(lineptr: &?[&]uint8, n: &usize, stream: &mut FILE) -> int;
119119
}

lib/c/src/libc/time.ri

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
// be found in the LICENSE file.
44

55
public struct timespec {
6-
tv_sec: isize;
7-
tv_nsec: isize;
6+
tv_sec: int;
7+
tv_nsec: int;
88
}

lib/c/src/libc/unistd.ri

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ extern (C) {
1212

1313
public func isatty(fd: int32) -> int32;
1414

15-
public func write(fd: int32, buf: rawptr, count: usize) -> isize;
16-
public func read(fildes: int32, buf: rawptr, nbyte: usize) -> isize;
15+
public func write(fd: int32, buf: rawptr, count: usize) -> int;
16+
public func read(fildes: int32, buf: rawptr, nbyte: usize) -> int;
1717

1818
public func rmdir(path: [&]uint8) -> int32;
1919
public func chdir(path: [&]uint8) -> int32;
2020
public func getcwd(buf: [&]uint8, size: usize) -> ?[&]uint8;
2121

22-
public func readlink(path: [&]uint8, buf: [&]uint8, size: usize) -> isize;
22+
public func readlink(path: [&]uint8, buf: [&]uint8, size: usize) -> int;
2323

2424
#if _LINUX_
2525
public func get_nprocs() -> int32;

lib/core/src/StaticBuffer.c.ri

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ struct StaticBuffer {
2121
return unsafe { libc.strtoul(&self.buf[0], none, 10) };
2222
}
2323

24-
public func as_isize(&self) -> isize {
24+
public func as_int(&self) -> int {
2525
self.buf[self.len] = 0;
26-
return unsafe { @as(isize, libc.strtol(&self.buf[0], none, 10))};
26+
return unsafe { @as(int, libc.strtol(&self.buf[0], none, 10))};
2727
}
2828

2929
public func as_string(&self) -> string {

lib/core/src/StringFormatter.ri

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ public struct StringFormatter {
3333
}
3434
value := args[arg_idx].to_string();
3535
if has_fwidth and fwidth > 0 {
36-
value_len := @as(isize, value.len);
36+
value_len := @as(int, value.len);
3737
if value_len <= fwidth {
3838
self.res.write_string(" ".repeat(@as(usize, fwidth - value_len)));
3939
}
4040
}
4141
self.res.write_string(value);
4242
if has_fwidth and fwidth < 0 {
4343
fwidth = -fwidth;
44-
value_len := @as(isize, value.len);
44+
value_len := @as(int, value.len);
4545
if value_len <= fwidth {
4646
self.res.write_string(" ".repeat(@as(usize, fwidth - value_len)));
4747
}
@@ -75,15 +75,15 @@ public struct StringFormatter {
7575
(has_fwidth, mut fwidth) := self.fwidth();
7676
value := args[index].to_string();
7777
if has_fwidth and fwidth > 0 {
78-
value_len := @as(isize, value.len);
78+
value_len := @as(int, value.len);
7979
if value_len <= fwidth {
8080
self.res.write_string(" ".repeat(@as(usize, fwidth - value_len)));
8181
}
8282
}
8383
self.res.write_string(value);
8484
if has_fwidth and fwidth < 0 {
8585
fwidth = -fwidth;
86-
value_len := @as(isize, value.len);
86+
value_len := @as(int, value.len);
8787
if value_len <= fwidth {
8888
self.res.write_string(" ".repeat(@as(usize, fwidth - value_len)));
8989
}
@@ -112,7 +112,7 @@ public struct StringFormatter {
112112
return self.res.to_string();
113113
}
114114

115-
func fwidth(mut self) -> (bool, isize) {
115+
func fwidth(mut self) -> (bool, int) {
116116
if unsafe { self.buf.ptr[self.i] != b':' } {
117117
return (false, 0);
118118
}
@@ -126,7 +126,7 @@ public struct StringFormatter {
126126
process_panic("string.fmt(): incomplete format string (index: {})", start);
127127
}
128128
}
129-
fwidth := buf.as_isize();
129+
fwidth := buf.as_int();
130130
if fwidth == 0 {
131131
process_panic(
132132
"string.fmt(): invalid width value (cannot be 0 and cannot be omitted) -> (index: {})",

lib/core/src/console.c.ri

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ public func console_is_atty(fd: int32) -> bool {
5353
#[unsafe]
5454
func write_buf_to_fd(fd: int32, buf: [&]uint8, len: usize) {
5555
unsafe {
56-
mut x: isize := 0;
57-
mut remaining_bytes := @as(isize, len);
56+
mut x: int := 0;
57+
mut remaining_bytes := @as(int, len);
5858
while remaining_bytes > 0 {
5959
x = libc.write(fd, @ptr_add(buf, x), @as(usize, remaining_bytes));
6060
remaining_bytes -= x;

lib/core/src/int.ri

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ extend int64 < Stringable {
148148
}
149149
}
150150

151-
extend isize < Stringable {
152-
public const MIN: isize := @as(isize, #if _x64_ int64.MIN #else int32.MIN #endif);
153-
public const MAX: isize := @as(isize, #if _x64_ int64.MAX #else int32.MAX #endif);
151+
extend int < Stringable {
152+
public const MIN: int := @as(int, #if _x64_ int64.MIN #else int32.MIN #endif);
153+
public const MAX: int := @as(int, #if _x64_ int64.MAX #else int32.MAX #endif);
154154

155155
#[inline]
156156
public func bits() -> uint32 {

lib/rivet/src/ast/Sym.ri

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ public struct Const < Sym {
290290
public mut expr: Expr;
291291
public mut evaled_expr: Expr;
292292
public mut has_evaled_size: bool;
293-
public mut evaled_size: isize;
293+
public mut evaled_size: int;
294294
public mut type: Type;
295295
public pos: token.Pos;
296296
}

lib/rivet/src/ast/Table.ri

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public struct Table {
3232
public mut int16_sym: TypeSym;
3333
public mut int32_sym: TypeSym;
3434
public mut int64_sym: TypeSym;
35-
public mut isize_sym: TypeSym;
35+
public mut int_sym: TypeSym;
3636
public mut uint8_sym: TypeSym;
3737
public mut uint16_sym: TypeSym;
3838
public mut uint32_sym: TypeSym;
@@ -53,7 +53,7 @@ public struct Table {
5353
public mut int16_t: Type;
5454
public mut int32_t: Type;
5555
public mut int64_t: Type;
56-
public mut isize_t: Type;
56+
public mut int_t: Type;
5757
public mut uint8_t: Type;
5858
public mut uint16_t: Type;
5959
public mut uint32_t: Type;
@@ -92,7 +92,7 @@ public struct Table {
9292
self.int16_sym = self.universe.scope.find_type_symbol_by_index_or_panic(3);
9393
self.int32_sym = self.universe.scope.find_type_symbol_by_index_or_panic(4);
9494
self.int64_sym = self.universe.scope.find_type_symbol_by_index_or_panic(5);
95-
self.isize_sym = self.universe.scope.find_type_symbol_by_index_or_panic(6);
95+
self.int_sym = self.universe.scope.find_type_symbol_by_index_or_panic(6);
9696
self.uint8_sym = self.universe.scope.find_type_symbol_by_index_or_panic(7);
9797
self.uint16_sym = self.universe.scope.find_type_symbol_by_index_or_panic(8);
9898
self.uint32_sym = self.universe.scope.find_type_symbol_by_index_or_panic(9);
@@ -110,7 +110,7 @@ public struct Table {
110110
self.int16_t = .Basic(self.int16_sym);
111111
self.int32_t = .Basic(self.int32_sym);
112112
self.int64_t = .Basic(self.int64_sym);
113-
self.isize_t = .Basic(self.isize_sym);
113+
self.int_t = .Basic(self.int_sym);
114114
self.uint8_t = .Basic(self.uint8_sym);
115115
self.uint16_t = .Basic(self.uint16_sym);
116116
self.uint32_t = .Basic(self.uint32_sym);
@@ -220,7 +220,7 @@ public struct Table {
220220
#[inline]
221221
public func is_signed_int(self, type: Type) -> bool {
222222
return type in [
223-
self.int8_t, self.int16_t, self.int32_t, self.int64_t, self.isize_t,
223+
self.int8_t, self.int16_t, self.int32_t, self.int64_t, self.int_t,
224224
self.comptime_int_t
225225
];
226226
}
@@ -500,7 +500,7 @@ public func universe() -> Module {
500500
TypeSym(name: "int16", info: .Int(16)),
501501
TypeSym(name: "int32", info: .Int(32)),
502502
TypeSym(name: "int64", info: .Int(64)),
503-
TypeSym(name: "isize", info: .Isize()),
503+
TypeSym(name: "int", info: .Isize()),
504504
TypeSym(name: "uint8", info: .Uint(8)),
505505
TypeSym(name: "uint16", info: .Uint(16)),
506506
TypeSym(name: "uint32", info: .Uint(32)),

lib/rivet/src/ast/TypeInfo.ri

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public enum TypeInfo < traits.Stringable {
169169
.Bool -> "bool",
170170
.Rune -> "rune",
171171
.Int as int_info -> "int{}".fmt(int_info.size),
172-
.Isize -> "isize",
172+
.Isize -> "int",
173173
.Uint as uint_info -> "uint{}".fmt(uint_info.size),
174174
.Usize -> "usize",
175175
.ComptimeInt -> "comptime_int",
@@ -195,7 +195,7 @@ public enum TypeInfo < traits.Stringable {
195195
#[boxed]
196196
public struct EnumVariant {
197197
public name: string;
198-
public value: isize;
198+
public value: int;
199199
public has_type: bool;
200200
public mut type: Type;
201201
public has_fields: bool;

lib/rivet/src/codegen/exprs.ri

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ extend Codegen {
1313
.Paren as paren -> self.gen_expr(paren.expr),
1414
//.Ident -> {},
1515
.BoolLiteral as bool_lit -> .Const(
16-
.IntConst(conv.bool_to_isize(bool_lit.value)), self.bool_t
16+
.IntConst(conv.bool_to_int(bool_lit.value)), self.bool_t
1717
),
1818
.IntegerLiteral as int_lit -> .Const(
19-
.IntConst(conv.string_to_isize(int_lit.value) catch @unreachable()),
19+
.IntConst(conv.string_to_int(int_lit.value) catch @unreachable()),
2020
self.usize_t
2121
),
2222
.FloatLiteral as float_lit -> .Const(
23-
.IntConst(conv.string_to_isize(float_lit.value) catch @unreachable()),
23+
.IntConst(conv.string_to_int(float_lit.value) catch @unreachable()),
2424
self.usize_t
2525
),
2626
else -> .Empty()

lib/rivet/src/codegen/mir/Expr.ri

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import std/strings;
99
public enum Expr < traits.Stringable {
1010
Empty,
1111
IntConst {
12-
value: isize;
12+
value: int;
1313
},
1414
FloatConst {
1515
value: float64;

lib/rivet/src/codegen/mod.ri

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public struct Codegen {
2424
mut mir: mir.ModuleIR;
2525
mut cur_func: mir.Func;
2626

27-
mut isize_t: mir.Type;
27+
mut int_t: mir.Type;
2828
mut usize_t: mir.Type;
2929
mut bool_t: mir.Type;
3030
mut vector_t: mir.Type;
@@ -63,7 +63,7 @@ public struct Codegen {
6363
}
6464

6565
func init_types(mut self) {
66-
self.isize_t = if self.table.prefs.target_is_64bit {
66+
self.int_t = if self.table.prefs.target_is_64bit {
6767
self.type_to_mir(self.table.int64_t)
6868
} else {
6969
self.type_to_mir(self.table.int32_t)

lib/rivet/src/parser/types.ri

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ extend Parser {
127127
"int16" -> .Basic(self.table.int16_sym, pos: expr_pos),
128128
"int32" -> .Basic(self.table.int32_sym, pos: expr_pos),
129129
"int64" -> .Basic(self.table.int64_sym, pos: expr_pos),
130-
"isize" -> .Basic(self.table.isize_sym, pos: expr_pos),
130+
"int" -> .Basic(self.table.int_sym, pos: expr_pos),
131131
"uint8" -> .Basic(self.table.uint8_sym, pos: expr_pos),
132132
"uint16" -> .Basic(self.table.uint16_sym, pos: expr_pos),
133133
"uint32" -> .Basic(self.table.uint32_sym, pos: expr_pos),

lib/rivet/src/resolver/mod.ri

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ public struct Resolver {
5858
}
5959
}
6060

61-
func eval_size(mut self, mut expr: ast.Expr) -> ?isize {
61+
func eval_size(mut self, mut expr: ast.Expr) -> ?int {
6262
return match expr is {
6363
.Paren as paren -> self.eval_size(paren.expr),
64-
.IntegerLiteral as int_lit -> conv.string_to_isize(int_lit.value) catch return none,
64+
.IntegerLiteral as int_lit -> conv.string_to_int(int_lit.value) catch return none,
6565
.Ident as mut ident -> {
6666
self.resolve_ident(ident);
6767
if ident.found {
@@ -89,7 +89,7 @@ public struct Resolver {
8989
.Amp -> left & right,
9090
.Pipe -> left | right,
9191
.Xor -> left ^ right,
92-
.Lshift -> @as(isize, @as(usize, left) << right),
92+
.Lshift -> @as(int, @as(usize, left) << right),
9393
.Rshift -> left >> right,
9494
else -> none
9595
}
@@ -103,9 +103,9 @@ public struct Resolver {
103103
if builtin_call.args[0].expr is .Type as mut type and self.resolve_type(type) {
104104
(size, align) := self.table.type_size(type);
105105
if builtin_call.name == "size_of" {
106-
@as(isize, size)
106+
@as(int, size)
107107
} else {
108-
@as(isize, align)
108+
@as(int, align)
109109
}
110110
} else {
111111
0
@@ -115,7 +115,7 @@ public struct Resolver {
115115
};
116116
}
117117

118-
func eval_sym(mut self, sym: ast.Sym, pos: token.Pos) -> ?isize {
118+
func eval_sym(mut self, sym: ast.Sym, pos: token.Pos) -> ?int {
119119
if sym is ast.Const as const_ {
120120
if !const_.has_evaled_size {
121121
const_.evaled_size = self.eval_size(const_.expr)?;

lib/rivet/src/utils/mod.ri

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public func green(msg: string) -> string {
8282
/// Rounds the number `n` up to the next mult
8383
/// NOTE: `multiple` must be a power of 2.#[inline]
8484
public func round_up(n: usize, multiple: usize) -> usize {
85-
n_ := @as(isize, n);
86-
multiple_ := @as(isize, multiple);
85+
n_ := @as(int, n);
86+
multiple_ := @as(int, multiple);
8787
return @as(usize, (n_ + multiple_ - 1) & (-multiple_));
8888
}

lib/std/src/conv/bool_to.ri

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ public func bool_to_usize(b: bool) -> usize {
88
}
99

1010
#[inline]
11-
public func bool_to_isize(b: bool) -> isize {
11+
public func bool_to_int(b: bool) -> int {
1212
return if b { 1 } else { 0 };
1313
}

lib/std/src/conv/parse_int.ri

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ public func parse_uint(s_: string, mut base: int32, mut bit_size: uint32) -> !us
136136
///
137137
/// The `bit_size` argument specifies the integer type that the result must
138138
/// fit into. Bit sizes 0, 8, 16, 32, and 64 correspond to int8, int16, int32, and
139-
/// isize. If `bit_size` is below 0 or above 64, an error is returned.
140-
public func parse_int(s: string, base: int32, mut bit_size: uint32) -> !isize {
139+
/// int. If `bit_size` is below 0 or above 64, an error is returned.
140+
public func parse_int(s: string, base: int32, mut bit_size: uint32) -> !int {
141141
if s == "" {
142142
throw InvalidSyntaxError("invalid syntax");
143143
}
@@ -166,7 +166,7 @@ public func parse_int(s: string, base: int32, mut bit_size: uint32) -> !isize {
166166
throw ValueOutOfRangeError("value out of range");
167167
}
168168

169-
return if neg { -@as(isize, un) } else { @as(isize, un) };
169+
return if neg { -@as(int, un) } else { @as(int, un) };
170170
}
171171

172172
/// Reports whether the underscores in `s_` are allowed.

lib/std/src/conv/string_to.ri

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ public func string_to_int64(s: string) -> !int64 {
3131
return @as(int64, parse_int(s, 0, 64)!);
3232
}
3333

34-
/// Equivalent to `parse_int(s, 0, isize.bits())`, converted to type `isize`.
34+
/// Equivalent to `parse_int(s, 0, int.bits())`, converted to type `int`.
3535
#[inline]
36-
public func string_to_isize(s: string) -> !isize {
37-
return parse_int(s, 0, isize.bits())!;
36+
public func string_to_int(s: string) -> !int {
37+
return parse_int(s, 0, int.bits())!;
3838
}
3939

4040
/// Equivalent to `parse_uint(s, 0, 8)`, converted to type `uint8`.

lib/std/src/flag/mod.ri

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,13 @@ public struct FlagParser {
200200

201201
/// Returns an option with the integer value, associated with the flag in `name`.
202202
/// When the flag is not given by the user, it returns `none`.
203-
public func int_flag(mut self, name: string, abbr: uint8, usage: string) -> ?isize {
203+
public func int_flag(mut self, name: string, abbr: uint8, usage: string) -> ?int {
204204
self.add_flag(name, abbr, usage, "<int>");
205205
parsed := self.parse_value(name, abbr);
206206
if parsed.is_empty() {
207207
return none;
208208
}
209-
return conv.string_to_isize(parsed[0]) catch 0;
209+
return conv.string_to_int(parsed[0]) catch 0;
210210
}
211211

212212
/// Returns an option with the string value, associated with the flag in `name`.

0 commit comments

Comments
 (0)