Added an array bound checking procedure

This commit is contained in:
ceriel 1988-03-18 18:08:20 +00:00
parent 33f80c6eef
commit 134869ad1a
2 changed files with 32 additions and 0 deletions

View file

@ -33,6 +33,7 @@ blockmove.c
stackprio.c
ChkCards.e
EM.e
rcka.e
rcku.e
rcki.e
rckul.e

31
lang/m2/libm2/rcka.e Normal file
View file

@ -0,0 +1,31 @@
#
;
; (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
; See the copyright notice in the ACK home directory, in the file "Copyright".
;
;
; Module: range checks for INTEGER, now for array indexing
; Author: Ceriel J.H. Jacobs
; Version: $Header$
;
#include <em_abs.h>
mes 2,EM_WSIZE,EM_PSIZE
exp $rcka
pro $rcka, 0
lol EM_PSIZE
zlt *1 ; lower bound always 0
lol EM_PSIZE
lal 0
loi EM_PSIZE
adp EM_WSIZE
loi EM_WSIZE
cmi EM_WSIZE
zgt *1
ret 0
1
loc EARRAY
trp
ret 0
end 0