SeraphScript/src/prim_type.rs

36 lines
761 B
Rust

use crate::defines::PointerSize;
#[derive(Eq, PartialEq, Debug)]
pub enum PrimitiveType {
Void,
Int8,
Int16,
Int32,
Int64,
UInt8,
UInt16,
UInt32,
UInt64,
Float,
Double,
Bool,
}
#[allow(dead_code)]
pub fn get_primitive_type_byte_size(t: PrimitiveType) -> PointerSize {
match t {
PrimitiveType::Void => 0,
PrimitiveType::Int8 => 1,
PrimitiveType::Int16 => 2,
PrimitiveType::Int32 => 4,
PrimitiveType::Int64 => 8,
PrimitiveType::UInt8 => 1,
PrimitiveType::UInt16 => 2,
PrimitiveType::UInt32 => 4,
PrimitiveType::UInt64 => 8,
PrimitiveType::Float => 4,
PrimitiveType::Double => 8,
PrimitiveType::Bool => 1,
}
}