mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
simplify RocStr to array in zig
This commit is contained in:
parent
f4726db63d
commit
012c6a75d1
1 changed files with 1 additions and 2 deletions
|
@ -221,8 +221,7 @@ pub const RocStr = extern struct {
|
|||
}
|
||||
|
||||
fn asArray(self: RocStr) [@sizeOf(RocStr)]u8 {
|
||||
const as_int = @ptrToInt(&self);
|
||||
const as_ptr = @intToPtr([*]u8, as_int);
|
||||
const as_ptr = @ptrCast([*]const u8, &self);
|
||||
const slice = as_ptr[0..@sizeOf(RocStr)];
|
||||
|
||||
return slice.*;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue