aboutsummaryrefslogtreecommitdiffstats
path: root/source/core.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/core.cpp')
-rw-r--r--source/core.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/source/core.cpp b/source/core.cpp
index 5842ad8..e2da109 100644
--- a/source/core.cpp
+++ b/source/core.cpp
@@ -40,15 +40,13 @@ void compileliteral()
bool haskey()
{
- return DICT[DIdxSrcLen] > 0;
+ return *((char *)&DICT[DIdxInBuf]) < DICT[DIdxSrcLen];
}
void addkey(int k)
{
- --DICT[DIdxSource];
- ++DICT[DIdxSrcLen];
-
- auto ptr = reinterpret_cast<char *>(DICT[DIdxSource]);
+ auto addr = DICT[DIdxSource] + (DICT[DIdxSrcLen]++);
+ auto ptr = reinterpret_cast<char *>(addr);
*ptr = static_cast<char>(k);
}
@@ -59,10 +57,8 @@ int key()
getinput();
auto ptr = reinterpret_cast<char *>(DICT[DIdxSource]);
- ++DICT[DIdxSource];
- --DICT[DIdxSrcLen];
-
- return *ptr;
+ int idx = (*((char *)&DICT[DIdxInBuf]))++;
+ return ptr[idx];
}
Cell *comma(Cell n)