aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/IntermediateRepresentation/OperandType.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ARMeilleure/IntermediateRepresentation/OperandType.cs')
-rw-r--r--ARMeilleure/IntermediateRepresentation/OperandType.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/ARMeilleure/IntermediateRepresentation/OperandType.cs b/ARMeilleure/IntermediateRepresentation/OperandType.cs
index bfdf5130..81b22cf5 100644
--- a/ARMeilleure/IntermediateRepresentation/OperandType.cs
+++ b/ARMeilleure/IntermediateRepresentation/OperandType.cs
@@ -47,5 +47,19 @@ namespace ARMeilleure.IntermediateRepresentation
throw new InvalidOperationException($"Invalid operand type \"{type}\".");
}
+
+ public static int GetSizeInBytesLog2(this OperandType type)
+ {
+ switch (type)
+ {
+ case OperandType.FP32: return 2;
+ case OperandType.FP64: return 3;
+ case OperandType.I32: return 2;
+ case OperandType.I64: return 3;
+ case OperandType.V128: return 4;
+ }
+
+ throw new InvalidOperationException($"Invalid operand type \"{type}\".");
+ }
}
} \ No newline at end of file