Switch to 32-bit math by default.

I'll need a way to get back into 64-bit mode.
This commit is contained in:
2025-09-17 11:38:14 -04:00
parent e8e2027a1a
commit cc4e57d6b5
2 changed files with 20 additions and 8 deletions

View File

@ -32,14 +32,17 @@ namespace Dillo::Hydrogen::JavaScriptForge ::detail:: StackMachine_m
class exports::StackMachine
{
private:
using Integer= std::int64_t;
using Long= std::uint64_t;
using Integer= std::int32_t;
using Float= long double;
using Value= std::variant< std::string, Integer, Long >;
// The main runtime stack of the forth engine.
// It grows on the "back".
// A `std::deque` is used instead of `std::vector`, because
// it helps cut down on large allocations, by subdividing things.
std::vector< std::variant< std::string, Integer > > stack;
std::vector< Value > stack;
// TODO: Should these tokens be binary?
// Upside: compressed.
@ -86,12 +89,13 @@ namespace Dillo::Hydrogen::JavaScriptForge ::detail:: StackMachine_m
void runWord( std::string_view word );
std::variant< std::string, Integer > pop();
std::variant< std::string, Integer > &peek();
Value pop();
Value &peek();
void push( std::string s );
void push( Integer s );
void push( std::variant< std::string, Integer > s );
void push( Long s );
void push( Value s );
template< typename T >
T pop();