ReservedHighlightId EnumItem values are ridiculously high

Earlier today, for whatever reason, I decided to check what EnumItem has the highest value. I just ran a simple command in the command bar that just looped through every single Enum, and it’s EnumItems.

I was expecting the highest value to be somewhere around maybe 2048 or even 4096, since most EnumItem values are some power of 2. I certainly wasn’t expecting it to be 524288 for an Enum that only has 4 items!!

Spoiler alert, the Enum in question was ‘ReservedHighlightId’, which I’ve never even heard about. I searched it up on the forum and only found 2 posts (Release Notes for 547 - #2 by Maximum_ADHD and Release Notes for 550 - #2 by Maximum_ADHD) that even mention this Enum, both being release notes.

What makes me believe that this is a bug, is the fact that the values for these EnumItems were normal at one point, but were seemingly randomly changed to these absurdly high numbers, which are interestingly still powers of 2 (Selection was 32, now it’s 524288 which is 2^19)

I don’t expect this to be high priority (or to even be fixed), I just thought that it was interesting and that maybe it was some sort of bug/glitch.

1 Like

It’s very likely that you’re seeing a “bitmask” here. All the numbers in ascending order correspond to the 17th, 18th, and 19th powers of two respectively.

Bitmasks are used to check for specific on/off switches within the same block of data, commonly an integer data type. Then, they can compare specific bits in the bitmask (which may have a combination of these by flipping multiple bits to 1) to see whether a specific highlight is active.

If you take A = 2, B = 8, they would be represented as 0010 and 1000 in 4 bits of binary respectively. These are the bitmasks. They can be compared with an arbitrary integer such as 10, 1010 in binary, to check which are present (in that example, both A and B are present as their corresponding bits in the integer are 1).

Because binary is base-2, the denary value of all single-bit bitmasks (where only one bit is 1 and the rest are 0) are powers of 2.

3 Likes

This would line up with the limit of ~31 active highlights at a time, assuming it’s a 32-bit flag for masking which elements in the scene are part of the highlight buffer, which would be intrinsically reduced when those reserved selection highlight bits are active.

2 Likes

This enumeration is used as a bit mask for internal use.

I thought so, thanks for confirming!