# Discussion: Upcoming @backingInt() and @fromBackingInt() convenience builtins

**URL:** <https://ziggit.dev/t/discussion-upcoming-backingint-and-frombackingint-convenience-builtins/16952>\
**Category:** News\
**Tags:** language\
**Created:** [July 27, 2026, 12:16pm UTC](https://ziggit.dev/t/discussion-upcoming-backingint-and-frombackingint-convenience-builtins/16952 "2026-07-27T12:16:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![tholmes](https://ziggit.dev/user_avatar/ziggit.dev/tholmes/32/5641_2.png) [@tholmes](https://ziggit.dev/u/tholmes)\
**Post date:** [July 27, 2026, 12:16pm UTC](https://ziggit.dev/t/discussion-upcoming-backingint-and-frombackingint-convenience-builtins/16952/1 "2026-07-27T12:16:44Z")

</div>

I just saw these in the master branch standard library and documentation:

> **[@backingInt - Documentation - The Zig Programming Language](https://ziglang.org/documentation/master/#backingInt)**
>
> Zig is a general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.

> **[@fromBackingInt - Documentation - The Zig Programming Language](https://ziglang.org/documentation/master/#fromBackingInt)**
>
> Zig is a general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.

They seem to use a new standard library construct: [std.meta.BackingInt()](https://ziglang.org/documentation/master/std/#std.meta.BackingInt)

Here’s an example of a function where they’re already being used: [std.log.logEnabled()](https://ziglang.org/documentation/master/std/#std.log.logEnabled)

While this is nothing that couldn’t have been implemented in userland with some imaginative use of `switch(@typeInfo(@TypeOf(arg)))`, it’s exciting to see new convenience builtins, which will surely be cited in the release notes as “part of the ongoing effort to improve ergonomics for game development”.

I bet a lot more people will be more willing to play around with packed structs and enums with these new builtins in place, particularly stuff like non-exhaustive enums as indices for concepts like Data-Oriented Design.

---

<div class="post-metadata">

**Author:** ![AndrewKraevskii](https://ziggit.dev/user_avatar/ziggit.dev/andrewkraevskii/32/2564_2.png) [@AndrewKraevskii](https://ziggit.dev/u/AndrewKraevskii)\
**Post date:** [July 27, 2026, 12:30pm UTC](https://ziggit.dev/t/discussion-upcoming-backingint-and-frombackingint-convenience-builtins/16952/2 "2026-07-27T12:30:33Z")

</div>

I already had opportunity to use it.  
[https://codeberg.org/andrewkraevskii/steam\_train/src/commit/e0248bee3cbfce75d25da73f28c1228acf160195/src/wasm4.zig#L62](https://codeberg.org/andrewkraevskii/steam_train/src/commit/e0248bee3cbfce75d25da73f28c1228acf160195/src/wasm4.zig#L62)  
Previously it would have been written as `@as(u32, @bitcast(self))`

---

<div class="post-metadata">

**Author:** ![spiffyk](https://ziggit.dev/user_avatar/ziggit.dev/spiffyk/32/7202_2.png) [@spiffyk](https://ziggit.dev/u/spiffyk)\
**Post date:** [July 27, 2026, 1:20pm UTC](https://ziggit.dev/t/discussion-upcoming-backingint-and-frombackingint-convenience-builtins/16952/3 "2026-07-27T13:20:30Z")

</div>

Having dabbled in embedded Zig recently, this will be a very welcome addition!

---

<div class="post-metadata">

**Author:** ![gavin-mcdiarmid](https://ziggit.dev/user_avatar/ziggit.dev/gavin-mcdiarmid/32/7818_2.png) [@gavin-mcdiarmid](https://ziggit.dev/u/gavin-mcdiarmid)\
**Post date:** [July 27, 2026, 11:13pm UTC](https://ziggit.dev/t/discussion-upcoming-backingint-and-frombackingint-convenience-builtins/16952/4 "2026-07-27T23:13:59Z")

</div>

The [commit](https://codeberg.org/ziglang/zig/commit/cb4c344e19a269ac227489a96e2ef53dd077ece0) also mentions:

> These builtins are meant to replace the now-deprecated `@intFromEnum` and  
> `@enumFromInt` builtins.

Fantastic that the behavior of these builtins can be generalized to packed structs/bitfields. And even without these new features, `@backingInt` would still be a better name than `@intFromEnum`.

---

<div class="post-metadata">

**Author:** ![tgirod](https://ziggit.dev/user_avatar/ziggit.dev/tgirod/32/3744_2.png) [@tgirod](https://ziggit.dev/u/tgirod)\
**Post date:** [July 28, 2026, 12:47pm UTC](https://ziggit.dev/t/discussion-upcoming-backingint-and-frombackingint-convenience-builtins/16952/5 "2026-07-28T12:47:19Z")

</div>

Interesting! I’m trying to grasp how to program an Arduino UNO with zig but [I can’t even cross-compile](https://codeberg.org/tgirod/uno_zig#2026-07-27) the most basic thing so far.

Do you have code I could read somewhere?

---

<div class="post-metadata">

**Author:** ![flow](https://ziggit.dev/letter_avatar_proxy/v4/letter/f/8edcca/32.png) [@flow](https://ziggit.dev/u/flow)\
**Post date:** [July 28, 2026, 1:20pm UTC](https://ziggit.dev/t/discussion-upcoming-backingint-and-frombackingint-convenience-builtins/16952/6 "2026-07-28T13:20:25Z")

</div>

Did you try microzig? AFAIK it has AVR/UNO support.

---

<div class="post-metadata">

**Author:** ![tgirod](https://ziggit.dev/user_avatar/ziggit.dev/tgirod/32/3744_2.png) [@tgirod](https://ziggit.dev/u/tgirod)\
**Post date:** [July 28, 2026, 1:33pm UTC](https://ziggit.dev/t/discussion-upcoming-backingint-and-frombackingint-convenience-builtins/16952/7 "2026-07-28T13:33:56Z")

</div>

I had a look but the documentation is very scarce, and it looks more like a big framework targeting many platforms - not ideal for a learning experiment. Also I didn’t find anything targeting UNO but maybe I simply missed it.

---

<div class="post-metadata">

**Author:** ![flow](https://ziggit.dev/letter_avatar_proxy/v4/letter/f/8edcca/32.png) [@flow](https://ziggit.dev/u/flow)\
**Post date:** [July 28, 2026, 1:37pm UTC](https://ziggit.dev/t/discussion-upcoming-backingint-and-frombackingint-convenience-builtins/16952/8 "2026-07-28T13:37:56Z")

</div>

> [@tgirod](#):
>
> Also I didn’t find anything targeting UNO but maybe I simply missed it.

> **[microzig/port/microchip/atmega/src/boards at...](https://github.com/ZigEmbeddedGroup/microzig/tree/0cabc4bfede8bbe7b4b948f9eaf816dd8d371d3e/port/microchip/atmega/src/boards)**
>
> MicroZig is a toolbox for building embedded applications in Zig. - ZigEmbeddedGroup/microzig

I found something.

Also you might need latest 0.17-dev to compile avr. It contains some fixes IIRC.

> <https://github.com/ZigEmbeddedGroup/microzig/pull/947>

---

<div class="post-metadata">

**Author:** ![spiffyk](https://ziggit.dev/user_avatar/ziggit.dev/spiffyk/32/7202_2.png) [@spiffyk](https://ziggit.dev/u/spiffyk)\
**Post date:** [July 28, 2026, 4:06pm UTC](https://ziggit.dev/t/discussion-upcoming-backingint-and-frombackingint-convenience-builtins/16952/9 "2026-07-28T16:06:45Z")

</div>

Can’t help with Arduino as I’m working with an ARM chip, which _just works_ with Zig 0.16.0. I’ve got this library code published, but it’s **very** incomplete and there’s no entry point as the only consumer I’ve got at the moment is specific to proprietary hardware under an NDA.

[https://codeberg.org/spiffyk/zig-sam-e5x-d5x](https://codeberg.org/spiffyk/zig-sam-e5x-d5x)
