ChanServ changed the topic of #zig to: zig programming language | https://ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
diltsman has quit [Ping timeout: 260 seconds]
azth has joined #zig
schme245 has quit [Remote host closed the connection]
azth has quit [Remote host closed the connection]
_Vi has joined #zig
tyler569 has joined #zig
mahmudov has quit [Read error: Connection reset by peer]
mahmudov has joined #zig
_Vi has quit [Ping timeout: 246 seconds]
ur5us has quit [Ping timeout: 260 seconds]
mahmudov has quit [Ping timeout: 240 seconds]
ur5us has joined #zig
<wilsonk> andrewrk: thought I would take a quick stab at issue #4020, bit if I modify ir.cpp so that ir_resolve_fn() is only called if CallModifier is always_inline, compile_time or async_kw then a new error comes up: 'cannot assign to constant'. There are only two spots that can happen: ir.cpp:17920 or 17940. 17940 is where the actual error message originates from so I assume allow_write_through_const is false when it should be true? Maybe?
darithorn has joined #zig
ur5us has quit [Ping timeout: 260 seconds]
marmotini_ has joined #zig
marmotini_ has quit [Remote host closed the connection]
marmotini_ has joined #zig
marmotini_ has quit [Read error: Connection reset by peer]
marmotini_ has joined #zig
<andrewrk> happy new year from -0500
marmotini_ has quit [Ping timeout: 258 seconds]
<leeward> \o/
swoogan has quit [Ping timeout: 260 seconds]
lunamn has quit [Ping timeout: 268 seconds]
ur5us has joined #zig
lunamn has joined #zig
schme245 has joined #zig
dddddd has quit [Remote host closed the connection]
_whitelogger has joined #zig
_whitelogger has joined #zig
schme245 has quit [Ping timeout: 240 seconds]
_whitelogger has joined #zig
mahmudov has joined #zig
ur5us has quit [Ping timeout: 260 seconds]
mahmudov has quit [Remote host closed the connection]
benjif_ has joined #zig
ur5us has joined #zig
benjif has quit [Ping timeout: 258 seconds]
marmotini_ has joined #zig
_whitelogger has joined #zig
return0e_ has joined #zig
return0e has quit [Ping timeout: 240 seconds]
mahmudov has joined #zig
mahmudov has quit [Remote host closed the connection]
mahmudov has joined #zig
return0e has joined #zig
return0e_ has quit [Ping timeout: 258 seconds]
darithorn has quit [Remote host closed the connection]
marmotini_ has quit [Remote host closed the connection]
ur5us has quit [Ping timeout: 260 seconds]
mahmudov has quit [Ping timeout: 258 seconds]
schme245 has joined #zig
<daurnimator> http://cliffle.com/blog/m4vga-in-rust/ they should have tried zig :P
_Vi has joined #zig
mahmudov has joined #zig
<companion_cube> maybe they wanted a stable language though :)
<Snektron> daurnimator, i found an old laptop with an i486, so maybe ill try to make something for that in Zig
<Snektron> it also has vga graphics
_Vi has quit [Ping timeout: 265 seconds]
<daurnimator> Snektron: would be more interesting to see zig running on stm32 devices
<daurnimator> is espressif in llvm 10?
mahmudov has quit [Ping timeout: 240 seconds]
marmotini_ has joined #zig
dddddd has joined #zig
dddddd has quit [Read error: Connection reset by peer]
dddddd has joined #zig
<daurnimator> no :(
protty has joined #zig
<frmdstryr> daurnimator: zig already works on stm32 devices, there's 2 projects on github
<frmdstryr> i've also got it working on one yesterday
<frmdstryr> the problem is porting all the drivers which are all in c
<daurnimator> frmdstryr: link?
<daurnimator> frmdstryr: yeah I figured as much. though @cImport should get you pretty far right?
<frmdstryr> haven't tested the armv8 one, i don't have one of those laying around
marmotini_ has quit [Remote host closed the connection]
mahmudov has joined #zig
_whitelogger has joined #zig
Akuli has joined #zig
<protty> is there a way to guarantee struct field layout order without using `extern struct`?
<fengb> Packed struct
<protty> do you have to specify the alignment of each field manually or does it still do that in a packed struct?
<fengb> Every field is assumed to be align 0
<fengb> So you’ll have to manually align them. And zig gets confused if the struct isn’t a multiple of 8 bits
<fengb> If you’re not actually packing, extern is fine since C struct alignment is well defined
<fengb> Actually wait... no it’s not. Forget I just said that
<protty> so extern struct all the way down?
<protty> hm, how would you go about fitting std structs in there as well?
<protty> nvm, think I can do this with alignment on fields instead
schme245 has quit [Remote host closed the connection]
azth has joined #zig
swoogan has joined #zig
schme245 has joined #zig
azth has quit [Remote host closed the connection]
<andrewrk> protty, you probably need https://github.com/ziglang/zig/issues/3133 to use packed structs for your use case
nullheroes has joined #zig
lunamn has quit [Ping timeout: 240 seconds]
lunamn has joined #zig
lunamn has quit [Ping timeout: 265 seconds]
lunamn has joined #zig
<swoogan> can the run step in a build.zig execute an arbitrary command?
<andrewrk> yes
<swoogan> thank you
SimonNa has joined #zig
marmotini_ has joined #zig
marmotini_ has quit [Ping timeout: 268 seconds]
marmotini_ has joined #zig
marmotini_ has quit [Ping timeout: 258 seconds]
_Vi has joined #zig
<schme245> in this code, is the if statement guaranteed to get inlined since the `encrypted` parameter is known at compile time? or does that only apply to comptime variables?
<schme245> `encrypt` parameter, sorry
<andrewrk> schme245, in order for encrypt to be known at compile time, you will need to annotate it with `comptime`
<andrewrk> but if you do that, then, yes
<schme245> hmm, that leaves me with an interesting conundrum
<schme245> I want to have the `desCryptCbc` method available in the API to give users flexibility, but I also want to use it to DRY up my code
<schme245> does that mean I need two versions of that function, a private one where `encrypt` is comptime, and a public one where it's not?
<andrewrk> do you actually need encrypt to be comptime known for semantic reasons? or are you considering performance?
<schme245> it's for performance
<andrewrk> have you measured it with and without making it comptime? I predict there will be no difference
<schme245> I agree, but I still think it's interesting whether this is possible or not
<andrewrk> sure, you can make your API whatever you want
<schme245> I'm trying to understand if it's possible to avoid this duplication: https://github.com/schmee/zig-crypto/compare/asdf?expand=1
<schme245> the only difference between desCryptCbcInline and desCryptCbc is that encrypt is comptime
<schme245> I understand that it doesn't matter for performance in this case, but there might be others where it does
azth has joined #zig
<andrewrk> where's the duplication?
<andrewrk> that looks fine to me
<andrewrk> oh, have desCryptCbc do an if on encrypt, and call desCryptCbcInline with comptime known encrypt
<andrewrk> I would also suggest enum{encrypt, decrypt} instead of bool
<andrewrk> make it first parameter too, and then API becomes: desCryptCbc(.encrypt, keys, iv, inData, outData)
<schme245> sorry, how do I call a fn with a comptime known parameter? I thought that had to go in the fn signature
<andrewrk> with an `if` on encrypt, within each branch of the `if` you have comptime-known encrypt
<andrewrk> if (x) foo(true) else foo(false)
<andrewrk> this will work even if foo has a comptime parameter
<andrewrk> definitely do the enum thing though, kill that bool
<schme245> alright, gimme a minute and I'll see if I got this straight
mahmudov has quit [Ping timeout: 265 seconds]
ur5us has joined #zig
<schme245> ahh so it would be like this then: https://github.com/schmee/zig-crypto/compare/asdf?expand=1
<azth> Hi all. When I run this locally (compiler version `zig-macos-x86_64-0.5.0+25051832b`), the program exits with a `SIGBUS (Misaligned address error)`. Link to program: https://godbolt.org/z/vooLCw
<azth> However, if I change line 10 to `var point = I32Wrapper{.x = 10}`, and call `var p = foo(&point)` it exits without errors.
mahmudov has joined #zig
<azth> Actually, I was able to reduce it to:
<azth> ```
darithorn has joined #zig
FSX is now known as fsx
fsx has quit [Quit: WeeChat 2.3]
fsx has joined #zig
<schme245> andrewrk: just updated the code with your suggestions, thanks a lot for your time! :)
<schme245> also, is DES of interest for the std lib? there's already AES in there, and while it's preferable there are many protocols which depend on DES
<hryx> Can anyone remind me how to build without @panic? I have the boilerplate code with `export fn entry` and `pub fn panic` but I forget if there's a required build flag
<fengb> release-fast should remove panic
<andrewrk> fengb, are you thinking of unreachable? @panic is defined to call the panic handler in all build modes
azth has quit [Remote host closed the connection]
<andrewrk> hryx, you're trying to get a minimal file for debugging zig ir, yes?
<fengb> Oh I thought the question is removing the handler
<fengb> For unreachable
<hryx> andrewrk: exactly. actually I was trying to shrink the output of what azth linked (but they just left)
<hryx> er, not zig IR in that case, but the asm
<hryx> thanks! I know mikdusan had a gist previously but looks like it's gone
lunamn has quit [Ping timeout: 258 seconds]
<hryx> ah, cool
<andrewrk> fengb, you are correct that if the panic handler is proven unreachable by the optimizer, it will be removed
<andrewrk> in a large application this is unlikely to be the case however
<fengb> Technically correct but not helpful. That’s me! :P
adamkowalski has joined #zig
adamkowalski has quit [Client Quit]
adamkowalski has joined #zig
adamkowalski has quit [Client Quit]
<hryx> Ahhhh now I see what I was doing wrong. I was using `zig run` instead of `zig build-obj`. derp
discip has joined #zig
<schme245> andrewrk: DES in std lib, yay or nay? (reposting my question from above in case you missed it, if not, sorry for spam!)
<andrewrk> schme245, yay with the caveat that it may be removed during https://github.com/ziglang/zig/issues/1629
<schme245> cool, I'll take a look at the other crypto in std and see if it makes sense to match the existing APIs!
<schme245> also, same caveats as for AES re timing attacks etc applies ;)
<andrewrk> yes, the relevant issue for that is https://github.com/ziglang/zig/issues/1776
lunamn has joined #zig
discip has quit [Ping timeout: 260 seconds]
adamkowalski has joined #zig
adamkowalski has quit [Client Quit]
adamkowalski has joined #zig
traviss has joined #zig
adamkowalski has quit [Client Quit]
<traviss> schme245, did you ever post your code for benchmarksgame? i was curious to see how you got vectorization to work for the nbody problem.
<schme245> well, as expected, it turns out I'm a dunce and the actual numbers are ~4-ish for my code and 2.6-ish for Rust
<schme245> next up now that I'm done with DES is to see if I can beat it with @Vector
<schme245> let me throw the code of the anyways
<schme245> wow, that'suuuh... one hell of a sentence xD anyway, here's the code: https://github.com/schmee/zig-experiments/blob/master/nbody.zig traviss
<schme245> traviss: ^
<traviss> ah. thats still sounds like a pretty good time. i tried myself to port the nbody-gcc-8.c solution but ran into problems related to _mm_cvtps_pd and similar
Aransentin has quit [Remote host closed the connection]
<traviss> thank you :)
protty has quit [Ping timeout: 260 seconds]
Akuli has quit [Quit: Leaving]
swoogan has quit [Ping timeout: 260 seconds]
ur5us has quit [Remote host closed the connection]
ur5us has joined #zig
return0e has quit [Read error: Connection reset by peer]
return0e has joined #zig
return0e has quit [Remote host closed the connection]
mahmudov has quit [Remote host closed the connection]