Cleanup use of macro inspection to use @typekind and @typeid macros.

This commit is contained in:
Christoffer Lerno
2023-11-18 23:35:11 +01:00
parent 87fdb5956e
commit d5281b10dd
13 changed files with 30 additions and 29 deletions

View File

@@ -94,7 +94,7 @@ bitstruct UInt128LE : uint128 @littleendian
macro read(bytes, $Type)
{
char[] s;
$switch ($typeof(bytes).kindof)
$switch (@typekind(bytes))
$case POINTER:
s = (*bytes)[:$Type.sizeof];
$default:
@@ -110,7 +110,7 @@ macro read(bytes, $Type)
macro write(x, bytes, $Type)
{
char[] s;
$switch ($typeof(bytes).kindof)
$switch (@typekind(bytes))
$case POINTER:
s = (*bytes)[:$Type.sizeof];
$default:
@@ -146,7 +146,7 @@ macro is_bitorder($Type)
macro bool is_array_or_sub_of_char(bytes)
{
$switch ($typeof(bytes).kindof)
$switch (@typekind(bytes))
$case POINTER:
var $Inner = $typefrom($typeof(bytes).inner);
$if $Inner.kindof == ARRAY:
@@ -164,7 +164,7 @@ macro bool is_array_or_sub_of_char(bytes)
macro bool is_arrayptr_or_sub_of_char(bytes)
{
$switch ($typeof(bytes).kindof)
$switch (@typekind(bytes))
$case POINTER:
var $Inner = $typefrom($typeof(bytes).inner);
$if $Inner.kindof == ARRAY: