diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2014-11-28 16:53:05 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2014-11-28 16:53:05 -0800 |
commit | 1b4131ff40cc46db75552917a851f8ea0655b8e5 (patch) | |
tree | 4ab63a0055aa8a9dd83217fe3aaf50a201c153b5 | |
parent | 6831aaabb98a0b52516c1e83f6b9d25e00505555 (diff) | |
download | mu-1b4131ff40cc46db75552917a851f8ea0655b8e5.tar.gz |
361 - *now* 'sizeof' on array pointers
-rw-r--r-- | mu.arc | 4 | ||||
-rw-r--r-- | mu.arc.t | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/mu.arc b/mu.arc index 6f214be1..397dd145 100644 --- a/mu.arc +++ b/mu.arc @@ -683,6 +683,10 @@ (trace "sizeof" x) (point return (when (and (acons x) + (pos 'deref metadata.x)) + (assert typeinfo.x!address) + (return (sizeof deref.x))) + (when (and (acons x) typeinfo.x!array) (return (+ 1 (* (m `(,v.x integer)) (sizeof typeinfo.x!elem))))) diff --git a/mu.arc.t b/mu.arc.t index 87926a9e..5deecb96 100644 --- a/mu.arc.t +++ b/mu.arc.t @@ -776,6 +776,9 @@ (= memory*.4 23) (if (~is 24 (sizeof '(4 integer-array))) (prn "F - 'sizeof' reads array lengths from memory")) +(= memory*.3 4) +(if (~is 24 (sizeof '(3 integer-array-address deref))) + (prn "F - 'sizeof' handles pointers to arrays")) (= memory*.14 34) (= routine* make-routine!foo) (if (~is 24 (sizeof '(4 integer-array))) |