From 3a046d6f89ab2d092423a2722ca30d9edc9775c2 Mon Sep 17 00:00:00 2001 From: nilspolek Date: Tue, 23 Jan 2024 15:41:31 +0100 Subject: [PATCH] Added some instructions for cmp --- Makefile | 1 + instruktion.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c61fe07..da38b3c 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ # Makefile for a simple C program build: + cd ./bigint; make; cd .. gcc -g -Wall -Ibigint/build/include -o support.o -c support.c gcc -g -Wall -Ibigint/build/include -o njvm.o -c njvm.c gcc -g -Wall -Lbigint/build/lib -o njvm njvm.o support.o -lbigint diff --git a/instruktion.c b/instruktion.c index d808823..616f18c 100644 --- a/instruktion.c +++ b/instruktion.c @@ -2,8 +2,10 @@ #define INSREUKTION #define IMMEDIATE(x) ((x) & 0x00FFFFFF) - +#define MSB (1 << (8 * sizeof(unsigned int) - 1)) +#define IS_PRIMITIVE(objRef) (((objRef)->size & MSB) == 0) #define SIGN_EXTEND(i) ((i) & 0x00800000 ? (i) | 0xFF000000 : (i)) +#define GET_ELEMENT_COUNT(objRef) ((objRef)->size & ~MSB) #define HALT 0 #define PUSHC 1