factor/vm/stacks.hpp

20 lines
422 B
C++
Raw Normal View History

2009-05-04 02:46:13 -04:00
namespace factor
{
#define DEFPUSHPOP(prefix,ptr) \
2009-05-04 05:50:24 -04:00
inline static cell prefix##peek() { return *(cell *)ptr; } \
inline static void prefix##repl(cell tagged) { *(cell *)ptr = tagged; } \
2009-05-05 12:33:35 -04:00
inline static cell prefix##pop() \
{ \
2009-05-04 05:50:24 -04:00
cell value = prefix##peek(); \
ptr -= sizeof(cell); \
return value; \
} \
2009-05-04 05:50:24 -04:00
inline static void prefix##push(cell tagged) \
{ \
2009-05-04 05:50:24 -04:00
ptr += sizeof(cell); \
prefix##repl(tagged); \
}
2009-05-04 02:46:13 -04:00
}