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/
<justin_smith> marijnfs: I'd usually use "1 << N" to create the operand, then use ^ to xor the two
<Gliptic> if it's a [32]u8, you need to compute which byte as well
<marijnfs> ok then I need logic to find the right u8 and work with that
<marijnfs> yeah
<ifreund> you could consider checking out std.PackedIntArray()
<marijnfs> that sounds interesting
<ifreund> though I don't know how well it'll map to whatever else you are doing
<marijnfs> although in general I like the simplicity of [32]u8
<marijnfs> yeah I also make an AutoHashMap with it e.g.
<marijnfs> probably starts to get annoying
<justin_smith> marijnfs: to find the byte for a given bit offset, you could use "N >> 3"
<justin_smith> then "N & 7" to find the offset in that byte - I thin
<justin_smith> k
<justin_smith> but maybe PackedIntArray is easier
<ifreund> you can also cast to the PackedIntArray and back if you want of course
<marijnfs> justin_smith: yeah i'm using / and % 256 for now;)
<marijnfs> but he doesn't like my shift
<marijnfs> : LHS of shift must be a fixed-width integer type, or RHS must be compile-time known
<marijnfs> id[byte_id] = id[byte_id] ^ (1 << bit_id);
<marijnfs> bit_id is a usize
<Gliptic> you need a specific type for that "1"
<ifreund> probably @as(u8, 1)
<ifreund> and bit_id would need to be a u3
<marijnfs> zig is picky
<marijnfs> ifreund: ok that worked, has to @intCast to u3.
<ifreund> can't just make it a u3?
<Gliptic> does zig understand that x & y becomes the narrower width integer of the two?
<Gliptic> if so, you'd think x & @as(u3, 7) would work
marijnfs has quit [Quit: WeeChat 2.8]
factormystic has quit [Read error: Connection reset by peer]
factormystic has joined #zig
jukan has joined #zig
<kameliya[m]> that'd be neat
factormystic has quit [Quit: The Lounge - https://thelounge.chat]
jukan has quit [Ping timeout: 260 seconds]
factormystic has joined #zig
wootehfoot has quit [Read error: Connection reset by peer]
gazler has joined #zig
gazler_ has quit [Read error: Connection reset by peer]
mmkarakaya has joined #zig
kbd has joined #zig
leon-p has quit [Quit: leaving]
kbd has quit [Quit: My Mac Mini has gone to sleep. ZZZzzz…]
notzmv has quit [Ping timeout: 246 seconds]
v0idify has quit [Remote host closed the connection]
v0idify has joined #zig
kbd has joined #zig
kbd has quit [Client Quit]
jukan has joined #zig
jukan has quit [Ping timeout: 240 seconds]
kbd has joined #zig
jukan has joined #zig
bitmapper has quit [Quit: Connection closed for inactivity]
cole-h has quit [Ping timeout: 256 seconds]
a_chou has joined #zig
a_chou has quit [Remote host closed the connection]
kbd has quit [Quit: My Mac Mini has gone to sleep. ZZZzzz…]
evbo has quit [Ping timeout: 256 seconds]
waleee-cl has quit [Quit: Connection closed for inactivity]
jukan has quit [Ping timeout: 240 seconds]
maier has joined #zig
kbd has joined #zig
jukan has joined #zig
jukan has quit [Ping timeout: 265 seconds]
leon-p has joined #zig
semarie has quit [Ping timeout: 246 seconds]
semarie has joined #zig
frett27_ has joined #zig
jukan has joined #zig
jukan has quit [Ping timeout: 240 seconds]
maier has quit [Ping timeout: 260 seconds]
maier has joined #zig
xackus has joined #zig
wootehfoot has joined #zig
<frett27_> hi, a small question, i working for a zig sample to use the cimgui, when importing the cimgui.h file, using @cImport , it does not compile https://pastebin.com/JjyVKnRy , any orientation on this will be helpfull for me
<frett27_> the code: https://pastebin.com/NAbDFm8z
<frett27_> seems there are cpp directive in this C code,
<ifreund> frett27_: might be worth checking out: https://github.com/SpexGuy/Zig-Imgui
<ifreund> and yeah it looks like there's c++ in the header you're using :/
<frett27_> ifreund: yes, i know this, but they reimplement the c definition in zig
<frett27_> and is sticked to windows
<frett27_> ifreund: from your perspective (better experience), do you think fixing the cimgui header is better, or make a native binding generator for zig ? (as they does it for c )?
<ifreund> native bindings will always be better than what @cImport() can provide
<ifreund> but they are usually more work as well
<frett27_> i had no experience in binding C++ to zig, any informations, projects or pointer ? is it also an option ?
<frett27_> ifreund: ho my, i'll looked at Zig-Imgui, the bindings are generated, i was messed up by the files in the repo
<frett27_> ifreund: 'll dig into it
<frett27_> ifreund: thank's for you attention
<ifreund> no problem!
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
jukan has joined #zig
jukan has quit [Ping timeout: 272 seconds]
kbd has quit [Quit: My Mac Mini has gone to sleep. ZZZzzz…]
xackus has quit [Ping timeout: 264 seconds]
maier has quit [Ping timeout: 256 seconds]
maier has joined #zig
maier has quit [Client Quit]
leah2 has quit [Ping timeout: 260 seconds]
sacredbirdman has joined #zig
<sacredbirdman> Hi, I have some trouble wrapping my head around this.. I have a multidimensional array declared like: var cmlen: [M_DIM][M_DIM][M_DIM]u32 = undefined;
<sacredbirdman> I have two questions.. how is this allocated.. should I be allocating the memory myself or is this sane code (say when M_DIM is 16)
<sacredbirdman> and what's the best way to initialize the whole thing to zero?
<ikskuh> heya sacredbirdman
<ikskuh> the memory is allocated automatically
<ikskuh> it's just a value like "var foo: u32 = undefined;"
<ikskuh> but bigger
<ikskuh> so it will be on the stack
<ikskuh> if it's a local variable
<ifreund> std.mem.zeros() to init to zero easily
<ikskuh> or in the static memory if it's a global variable
leah2 has joined #zig
<ikskuh> var cmlen = std.mem.zeroes([M_DIM][M_DIM][M_DIM]u32);
<sacredbirdman> thanks, that looks good :)
<ikskuh> std.mem.zeroes is really convenient
<ifreund> hmm, I think we need non-exhaustive tagged unions
<ifreund> or can you already do that by setting the enum manually?
<ikskuh> hm, good question
<ifreund> looks like you can use a non-exhaustive enum to define a tagged union but it doesn't force you to handle the else branch when switching on the union
<ifreund> so yeah, we need that
<ifreund> cause currently zig-wayland isn't properly forward-compatible because of this
sacredbirdman has quit [Ping timeout: 248 seconds]
notzmv has joined #zig
Kiori has joined #zig
Kiori has quit [Remote host closed the connection]
Kiori has joined #zig
Kiori has quit [Remote host closed the connection]
xackus has joined #zig
Akuli has joined #zig
notzmv has quit [Ping timeout: 240 seconds]
HarryHaaren has joined #zig
<HarryHaaren> hey folks, anybody used Zig CC mode for cross-compile using Meson build system?
cole-h has joined #zig
<ifreund> HarryHaaren: you probably need a master build of zig: https://github.com/ziglang/zig/pull/7833
<HarryHaaren> ifreund: Nice one thanks!
mmkarakaya has quit [Quit: Quit]
<HarryHaaren> posted a comment on the PR, i'm having issues configuring the build with Meson and CC="zig cc" details at: https://github.com/ziglang/zig/pull/7833#issuecomment-766366968
mmkarakaya has joined #zig
jukan has joined #zig
hristo has joined #zig
<hristo> Hi. I've submitted a pull request but the Microsoft CI thing failed on Linux (`apt-get update` failed, https://dev.azure.com/ziglang/zig/_build/results?buildId=12056&view=logs&j=9512b82f-d185-50ea-ee23-d010bc14782f). Can I re-run it?
<g-w1> rebase with master is usually the best way or have someone close and re-open it
jukan has quit [Ping timeout: 256 seconds]
kbd has joined #zig
hristo has quit [Quit: hristo]
kbd has quit [Client Quit]
leah2 has quit [Ping timeout: 244 seconds]
<Akuli> i have pushed empty commits to trigger ci in the past
<Akuli> git commit --allow-empty
leah2 has joined #zig
bitmapper has joined #zig
Piraty has joined #zig
<HarryHaaren> hey all - I just downloaded latest Zig master tarball, but there's no README on how to install/use. I know I can use "inplace", but I'm attempting to have Meson (build system) pick up the Zig install, so want the zig binary in /usr/local/bin.
<HarryHaaren> TLDR: Is there a "proper" way to install Zig from master-tarball?
<HarryHaaren> (temp workaround identified, use absolute path to Zig, leaving the zig lib/* data in place)
<ifreund> HarryHaaren: the lib folder just needs to stay in the same place relative to the binary
<ifreund> so put it in /usr/local/lib if your binary is in /usr/local/bin
<HarryHaaren> ifreund: thanks again!
<ifreund> I prefer ~/.local myself though for such things
<ifreund> no problem!
<HarryHaaren> yeah good point - i tend to abuse /local a bit, but ~/.local is a better idea
waleee-cl has joined #zig
evbo has joined #zig
squeek502 has quit [Ping timeout: 246 seconds]
jukan has joined #zig
jukan has quit [Ping timeout: 240 seconds]
wjlroe has quit [Quit: Connection closed for inactivity]
hristo has joined #zig
isolier0 has joined #zig
isolier has quit [Ping timeout: 272 seconds]
isolier0 is now known as isolier
<andrewrk> welcome HarryHaaren! I have a fond memory of meeting you and chatting with you at the VLC conference many years ago in Dublin :)
mikdusan has quit [Quit: WeeChat 2.5]
<HarryHaaren> hey andrewrk, you've a good memory, yes indeed, it was good fun
<HarryHaaren> Working on using ZigCC for some static x86_64 to arm64 cross-compilation, so far making progress
ur5us has joined #zig
<HarryHaaren> with Meson build system - you merged some feature support 5 days ago - nice nice, that's confirmed working here
<HarryHaaren> will report back in a bit how i'm getting on with the rest of it
* HarryHaaren away for the evening, late-ish in IE now, so catch ya another time!
HarryHaaren has quit [Quit: WeeChat 2.9]
<andrewrk> see ya
xackus has quit [Ping timeout: 240 seconds]
frett27 has joined #zig
frett27_ has quit [Ping timeout: 272 seconds]
bitmapper has quit [Quit: Connection closed for inactivity]
ur5us has quit [Ping timeout: 264 seconds]
bitmapper has joined #zig
kbd has joined #zig
mikdusan has joined #zig
ur5us has joined #zig
motiejus has joined #zig
jukan has joined #zig
jukan has quit [Ping timeout: 240 seconds]
Akuli has quit [Quit: Leaving]
<motiejus> hi all. Does `zig cc` bundle/expose `ld`? I am trying to compile `xz`, and `./configure` script fails, as it doesn't find ld. Also/more details on SO: https://stackoverflow.com/questions/65876143/does-zig-cc-expose-a-linker-ld
<g-w1> zig ld.lld
wootehfoot has quit [Quit: Leaving]
hristo has quit [Quit: hristo]
ur5us has quit [Ping timeout: 240 seconds]
<motiejus> thanks. what about `ar` and `as`?
<g-w1> hmm I dont know, but for the linker, ld.lld is only elf. check main.zig:2897 for the others
ur5us has joined #zig
mmkarakaya has quit [Quit: Connection closed]
<motiejus> thanks. I can't find it there easily, but don't need it for xz (another time). have a good day
hnOsmium0001 has joined #zig
<andrewrk> motiejus, for ar you can do `zig build-lib` and for `as` you can do `zig build-obj`
<andrewrk> for as you can also use `zig cc`
<motiejus> thanks!
jukan has joined #zig
<motiejus> Another question: is `zig cc` a long-term feature, or something you added "temporarily" until you have a self hosted compiler? I am contemplating to create a bazel clang toolchain on top of `zig cc`, but not sure about its plans/longevity
<motiejus> Will it be useful/necessary for zig itself post v1?
<andrewrk> motiejus, long term feature that will always be available when llvm extensions are enabled
<daurnimator> `zig build-lib` isn't 100% compatible with ar... maybe we should have a `zig ar` for compat reasons?
<andrewrk> I think that's a worthwhile proposal
<motiejus> Can you elaborate on llvm extensions? Not sure if you are referring to this: https://llvm.org/docs/Extensions.html
<motiejus> For my purposes (clang frontend) it seems like I can just ignore the second part of the sentence? :)
fritchie has quit [Remote host closed the connection]
<andrewrk> I gave you an unnecessary amount of detail - I only meant to communicate that Zig's LLVM dependency is optional
<andrewrk> yes zig cc is here to stay :)
jukan has quit [Ping timeout: 246 seconds]
jukan has joined #zig
leon-p has quit [Quit: leaving]
frett27 has quit [Ping timeout: 240 seconds]