aboutsummaryrefslogtreecommitdiff
path: root/src/sourcemap/sourcemap.zig
diff options
context:
space:
mode:
authorGravatar Dylan Conway <35280289+dylan-conway@users.noreply.github.com> 2023-06-21 23:38:18 -0700
committerGravatar GitHub <noreply@github.com> 2023-06-21 23:38:18 -0700
commit5fa13625a1ca0ea1a3a1c5bb86d0880dcfac349f (patch)
tree97f669a178e60772038751d690c3e298a63557b2 /src/sourcemap/sourcemap.zig
parentbfb322d618a3f0e9618d311ae69016fe7a08e771 (diff)
downloadbun-5fa13625a1ca0ea1a3a1c5bb86d0880dcfac349f.tar.gz
bun-5fa13625a1ca0ea1a3a1c5bb86d0880dcfac349f.tar.zst
bun-5fa13625a1ca0ea1a3a1c5bb86d0880dcfac349f.zip
upgrade zig to `v0.11.0-dev.3737+9eb008717` (#3374)
* progress * finish `@memset/@memcpy` update * Update build.zig * change `@enumToInt` to `@intFromEnum` and friends * update zig versions * it was 1 * add link to issue * add `compileError` reminder * fix merge * format * upgrade to llvm 16 * Revert "upgrade to llvm 16" This reverts commit cc930ceb1c5b4db9614a7638596948f704544ab8. --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com> Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/sourcemap/sourcemap.zig')
-rw-r--r--src/sourcemap/sourcemap.zig22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/sourcemap/sourcemap.zig b/src/sourcemap/sourcemap.zig
index f1bbcc4c1..0b245d8c7 100644
--- a/src/sourcemap/sourcemap.zig
+++ b/src/sourcemap/sourcemap.zig
@@ -871,14 +871,14 @@ pub const LineOffsetTable = struct {
if (column == 0) {
line_byte_offset = @truncate(
u32,
- @ptrToInt(remaining.ptr) - @ptrToInt(contents.ptr),
+ @intFromPtr(remaining.ptr) - @intFromPtr(contents.ptr),
);
}
if (c > 0x7F and columns_for_non_ascii.items.len == 0) {
- std.debug.assert(@ptrToInt(
+ std.debug.assert(@intFromPtr(
remaining.ptr,
- ) >= @ptrToInt(
+ ) >= @intFromPtr(
contents.ptr,
));
// we have a non-ASCII character, so we need to keep track of the
@@ -886,9 +886,9 @@ pub const LineOffsetTable = struct {
columns_for_non_ascii.appendAssumeCapacity(column);
column_byte_offset = @intCast(
u32,
- (@ptrToInt(
+ (@intFromPtr(
remaining.ptr,
- ) - @ptrToInt(
+ ) - @intFromPtr(
contents.ptr,
)) - line_byte_offset,
);
@@ -899,7 +899,7 @@ pub const LineOffsetTable = struct {
if (columns_for_non_ascii.items.len > 0) {
const line_bytes_so_far = @intCast(u32, @truncate(
u32,
- @ptrToInt(remaining.ptr) - @ptrToInt(contents.ptr),
+ @intFromPtr(remaining.ptr) - @intFromPtr(contents.ptr),
)) - line_byte_offset;
columns_for_non_ascii.ensureUnusedCapacity((line_bytes_so_far - column_byte_offset) + 1) catch unreachable;
while (column_byte_offset <= line_bytes_so_far) : (column_byte_offset += 1) {
@@ -956,7 +956,7 @@ pub const LineOffsetTable = struct {
},
else => {
// Mozilla's "source-map" library counts columns using UTF-16 code units
- column += @as(i32, @boolToInt(c > 0xFFFF)) + 1;
+ column += @as(i32, @intFromBool(c > 0xFFFF)) + 1;
},
}
@@ -1032,7 +1032,7 @@ pub fn appendMappingToBuffer(buffer_: MutableString, last_byte: u8, prev_state:
@as(u32, vlq[1].len) +
@as(u32, vlq[2].len) +
@as(u32, vlq[3].len);
- buffer.growIfNeeded(total_len + @as(u32, @boolToInt(needs_comma))) catch unreachable;
+ buffer.growIfNeeded(total_len + @as(u32, @intFromBool(needs_comma))) catch unreachable;
// Put commas in between mappings
if (needs_comma) {
@@ -1081,12 +1081,12 @@ pub const Chunk = struct {
filename = filename[FileSystem.instance.top_level_dir.len - 1 ..];
} else if (filename.len > 0 and filename[0] != '/') {
filename_buf[0] = '/';
- @memcpy(filename_buf[1..], filename.ptr, filename.len);
+ @memcpy(filename_buf[1..][0..filename.len], filename);
filename = filename_buf[0 .. filename.len + 1];
}
output.growIfNeeded(
- filename.len + 2 + (source.contents.len * @as(usize, @boolToInt(include_sources_contents))) + chunk.buffer.list.items.len + 32 + 39 + 29 + 22 + 20,
+ filename.len + 2 + (source.contents.len * @as(usize, @intFromBool(include_sources_contents))) + chunk.buffer.list.items.len + 32 + 39 + 29 + 22 + 20,
) catch unreachable;
try output.append("{\n \"version\":3,\n \"sources\": [");
@@ -1288,7 +1288,7 @@ pub const Chunk = struct {
else => {
// Mozilla's "source-map" library counts columns using UTF-16 code units
- b.generated_column += @as(i32, @boolToInt(c > 0xFFFF)) + 1;
+ b.generated_column += @as(i32, @intFromBool(c > 0xFFFF)) + 1;
},
}
}