ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
steveno has joined #zig
steveno has quit [Client Quit]
kristate has quit [Remote host closed the connection]
kristate has joined #zig
kristate has quit [Ping timeout: 268 seconds]
dcefram has joined #zig
dcefram has quit [Client Quit]
zez1c has quit [Ping timeout: 272 seconds]
_whitelogger has joined #zig
kristate has joined #zig
presiden has joined #zig
meheleventyone has joined #zig
forgot-password has joined #zig
<forgot-password>
Calling @typeInfo on a slice gives me back a TypeInfo.Pointer with a size value of 'Slice', correct?
meheleventyone has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Hejsil has joined #zig
<Hejsil>
Yes, forgot-password
<forgot-password>
So if I were to create a function that could handle slices *and* arrays I had to check via @typeInfo to get a pointer to the actual data, right? Because &<slice> gives me a pointer to the slice struct instead of its contents for which I need <slice>.ptr
<Hejsil>
I'm not sure exactly what you're trying to do. Why do you need to know that it's an array or a slice
<Hejsil>
These types support most of the same operations
<forgot-password>
Wait, I'm gonna put together a little sample. I want to pass the data to OpenGL
<Hejsil>
Alright
<Hejsil>
I guess you need a ?[*]T correct?
<Hejsil>
You could do: arr_or_slice[0..].ptr
hooo has joined #zig
<forgot-password>
I need a ?*const c_void
<forgot-password>
And my function takes a parameter "geometry: var"
<forgot-password>
To that I need a pointer
<forgot-password>
&geometry works fine for arrays, but it fails for structs. Presumably to the aforementioned reason
<Hejsil>
This should work too: &arr_or_slice[0]
<Hejsil>
I would think
<Hejsil>
Hmm, unless your slice/array is len 0
<forgot-password>
At least currently it fails if I pass an array of len 0
<Hejsil>
This is my best hack: &arr_or_slice[0..].ptr[0]
<Hejsil>
There should probably be a unified way for arrays and slices to get the underlying data
<forgot-password>
Thanks, &arr_or_slice[0] worked perfectly fine
<forgot-password>
Though I agree with you about the unified way to access the underlying data. It was rather confusing the first time I tried to pass &slice to glBufferData
steveno has joined #zig
_whitelogger has joined #zig
hgctl has joined #zig
Hejsil has quit [Quit: Page closed]
Zaab1t has joined #zig
zez1c has joined #zig
forgot-password has quit [Quit: leaving]
steveno has quit [Ping timeout: 250 seconds]
steveno has joined #zig
Ichorio has joined #zig
wootehfoot has joined #zig
kristate has quit [Remote host closed the connection]
meheleventyone has joined #zig
meheleventyone has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
steveno has quit [Quit: Leaving]
forgot-password has joined #zig
<MajorLag>
RE: #1503, It kinda feels like an issue you'd get when dealing with padded data buffers and forgetting to adjust for the padding. I'm not sure what that would mean in this context though.
<MajorLag>
by padded, I mean aligned. Like how BMP aligns rows of pixels to 4-byte boundaries.
forgot-password has quit [Ping timeout: 258 seconds]
kristate has joined #zig
kristate has quit [Ping timeout: 250 seconds]
forgot-password has joined #zig
Zaab1t has quit [Quit: bye bye friends]
forgot-password has quit [Ping timeout: 245 seconds]
hooo_ has joined #zig
noonien_ has joined #zig
walac_ has joined #zig
forgot-password has joined #zig
noonien has quit [Ping timeout: 268 seconds]
walac has quit [Ping timeout: 268 seconds]
MajorLag has quit [Ping timeout: 268 seconds]
noonien_ is now known as noonien
hooo has quit [Ping timeout: 268 seconds]
walac_ is now known as walac
hooo_ is now known as hooo
MajorLag has joined #zig
forgot-password has quit [Ping timeout: 258 seconds]
hgctl has quit [Quit: WeeChat 2.3]
forgot-password has joined #zig
kristate has joined #zig
kristate has quit [Ping timeout: 268 seconds]
Ichorio has quit [Ping timeout: 246 seconds]
<forgot-password>
Hey, I was just wondering if the parameters are flipped intentionally between std.math.atan2 and its underlying functions atan2_32/64.
wootehfoot has quit [Read error: Connection reset by peer]
<andrewrk>
forgot-password, good catch. the names are incorrect in std.math.atan2. the first arg is y and second is x. I'll push a fix
<andrewrk>
pushed
<forgot-password>
andrewrk: Nice, thank you
<forgot-password>
I was playing around with custom format functions earlier today, and I thought that the fmt parameter to said function is just what's inbetween the braces, but that doesn't seem to be the case, right?
<andrewrk>
I'm not sure, I haven't looked at the details of that code recently. But keep in mind there's an API overhaul planned: https://github.com/ziglang/zig/issues/1358
forgot-password has quit [Ping timeout: 246 seconds]