Fixed const vector codegen. Missing math comparisons.

This commit is contained in:
Christoffer Lerno
2023-05-06 02:29:26 +02:00
parent db8c46d6c5
commit 3dd6675e1b
6 changed files with 129 additions and 18 deletions

View File

@@ -8,28 +8,31 @@
module std::collections::enumset<Enum>;
const IS_CHAR_ARRAY = Enum.elements > 128;
$switch
$case (Enum.elements > 128):
typedef EnumSetType @private = char[(Enum.elements + 7) / 8];
const IS_CHAR_ARRAY = true;
def EnumSetType @private = char[(Enum.elements + 7) / 8];
$case (Enum.elements > 64):
typedef EnumSetType @private = uint128;
const IS_CHAR_ARRAY = false;
def EnumSetType @private = uint128;
$case (Enum.elements > 32 || $$C_INT_SIZE > 32):
typedef EnumSetType @private = ulong;
const IS_CHAR_ARRAY = false;
def EnumSetType @private = ulong;
$case (Enum.elements > 16 || $$C_INT_SIZE > 16):
typedef EnumSetType @private = uint;
const IS_CHAR_ARRAY = false;
def EnumSetType @private = uint;
$case (Enum.elements > 8 || $$C_INT_SIZE > 8):
typedef EnumSetType @private = ushort;
const IS_CHAR_ARRAY = false;
def EnumSetType @private = ushort;
$default:
typedef EnumSetType @private = char;
const IS_CHAR_ARRAY = false;
def EnumSetType @private = char;
$endswitch
typedef EnumSet = distinct EnumSetType;
def EnumSet = distinct EnumSetType;
fn void EnumSet.add(EnumSet* this, Enum v)
{