diff options
Diffstat (limited to 'src/ir/int.rs')
-rw-r--r-- | src/ir/int.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/ir/int.rs b/src/ir/int.rs new file mode 100644 index 00000000..d2769b77 --- /dev/null +++ b/src/ir/int.rs @@ -0,0 +1,30 @@ +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] +pub enum IntKind { + Bool, + Char, + UChar, + Short, + UShort, + Int, + UInt, + Long, + ULong, + LongLong, + ULongLong, + U16, // For Char16 and Wchar + U32, // For Char32 + // Though now we're at it we could add equivalents for the rust types... +} + +impl IntKind { + pub fn is_signed(&self) -> bool { + use self::IntKind::*; + match *self { + Bool | UChar | UShort | + UInt | ULong | ULongLong | U16 | U32 => false, + + Char | Short | Int | + Long | LongLong => true, + } + } +} |