<div dir="auto">No, because ordinal returns 0, 1, 2, 3, 4, 5, etc for each subsequent value. Whereas, it sounds like you need it to return 1, 2, 4, 8, etc. You could do the transformation yourself, of course.<div dir="auto"><br></div><div dir="auto">But if that doesn't work, maybe come at this from the opposite direction?</div><div dir="auto"><br></div><div dir="auto">What, in Java, gives you this OR-like functionality for enums? EnumSet! Maybe the better answer would be to have some way to return a long or long[] from an EnumSet to represent the included values?</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Mon, Jul 7, 2025, 2:40 PM Vivek Narang <<a href="mailto:duke@openjdk.org">duke@openjdk.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, 3 Jul 2025 09:38:18 GMT, Maurizio Cimadamore <<a href="mailto:mcimadamore@openjdk.org" target="_blank" rel="noreferrer">mcimadamore@openjdk.org</a>> wrote:<br>
<br>
> <br>
> ```<br>
> enum Color<br>
> {<br>
>     Red,<br>
>     Green,<br>
>     Blue,<br>
> }<br>
> ```<br>
> <br>
> C code can do things like `Red | Blue` -- which are not possible with Java enums.<br>
> <br>
Hey @mcimadamore please excuse my gap in understanding here, but won't this operation be possible in Java by doing: `Color.Red.ordinal() | Color.Blue.ordinal()`?<br>
<br>
-------------<br>
<br>
PR Comment: <a href="https://git.openjdk.org/jextract/pull/284#issuecomment-3046175531" rel="noreferrer noreferrer" target="_blank">https://git.openjdk.org/jextract/pull/284#issuecomment-3046175531</a><br>
</blockquote></div>