Add saturated math and expect macros.

This commit is contained in:
Christoffer Lerno
2023-02-03 00:25:29 +01:00
parent 6407eb47a4
commit 6b928c7a3d
9 changed files with 124 additions and 2 deletions

View File

@@ -120,6 +120,17 @@ macro enum_by_name($Type, String enum_name) @builtin
return SearchResult.MISSING!;
}
macro bool @expect_true(bool value) @builtin => $$expect(value, true);
macro bool @expect_false(bool value) @builtin => $$expect(value, false);
/**
* @require values.is_int(value)
* @checked $typeof(value) a = expected
**/
macro @expect(value, expected) @builtin
{
return $$expect(value, ($typeof(value))expected);
}
/**
* Locality for prefetch, levels 0 - 3, corresponding
* to "extremely local" to "no locality"