#truncating ptr in comptime

1 messages · Page 1 of 1 (latest)

tough nymph
#

yep, not possible

#

also on 64-bit systems, the address won't necessarily fit into a u32 anyway

#

unless you're doing some very weird stuff?

still pagoda
#

Yep its for freestanding target

#

It works if v.b is *const [_]u64 but in that case i cannot truncate it to u32

tough nymph
#

is there a reason you have to do this at comptime?

still pagoda
#

Its not that matter if its comptime but i just want to have some such structure inside data section

tough nymph
#

why not just set the pointer at startup?

still pagoda
#

I was porting assembly to Zig, so i just wanted to preserve assembly structure
(for a slight, trivial performance benefit)

#

Hardcoding things

tough nymph
#

i mean there's literally no performance benefit to setting it at comptime instead of runtime

#

it saves like 4 cycles on your startup time lol, that's it

still pagoda
#

Yeah thats why i said trivial

#

So there is no way to do this in zig?

#

Thx for answering i appreciate much

#

I just need to find another way like setting it at runtime