From 1bfeeb1755712bbef180311c47e8838c91c17f08 Mon Sep 17 00:00:00 2001 From: John Date: Mon, 26 Feb 2024 15:32:49 -0600 Subject: [PATCH] interpreter: shrink integers to pointer-size in temp type implementation, for speed --- libconlang/src/interpreter.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libconlang/src/interpreter.rs b/libconlang/src/interpreter.rs index 0e0649e..5bbe6a0 100644 --- a/libconlang/src/interpreter.rs +++ b/libconlang/src/interpreter.rs @@ -27,6 +27,9 @@ pub mod temp_type_impl { BuiltIn, Callable, Environment, }; use std::ops::*; + + type Integer = isize; + /// A Conlang value /// /// This is a hack to work around the fact that Conlang doesn't @@ -37,7 +40,7 @@ pub mod temp_type_impl { #[default] Empty, /// An integer - Int(i128), + Int(Integer), /// A boolean Bool(bool), /// A unicode character @@ -49,9 +52,9 @@ pub mod temp_type_impl { /// A tuple Tuple(Vec), /// An exclusive range - RangeExc(i128, i128), + RangeExc(Integer, Integer), /// An inclusive range - RangeInc(i128, i128), + RangeInc(Integer, Integer), /// A callable thing Function(Function), /// A built-in function @@ -154,7 +157,7 @@ pub mod temp_type_impl { })* } from! { - i128 => ConValue::Int, + Integer => ConValue::Int, bool => ConValue::Bool, char => ConValue::Char, &str => ConValue::String,