From 0e7757ba7a473d81fc846cb2bc0687a168f6804b Mon Sep 17 00:00:00 2001 From: Nathan Froyd Subject: [PATCH 21/39] introduce TRIE-CHILDREN-VECTOR type --- src/lisp/structs.lisp | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/lisp/structs.lisp b/src/lisp/structs.lisp index 03f848d..a39dfd1 100755 --- a/src/lisp/structs.lisp +++ b/src/lisp/structs.lisp @@ -25,6 +25,8 @@ (cols nil :type integer) (config nil :type list)) +(deftype trie-children-vector () '(simple-vector 30)) + (defstruct (trie) ;; data structure used to load ;; and search the dictionary. @@ -35,7 +37,7 @@ (is-word nil :type boolean) (text "" :type string) (parent nil);;:type trie) - (children (make-array 30) :type simple-vector)) + (children (make-array 30) :type trie-children-vector)) ;; struct functions @@ -130,10 +132,9 @@ (children (trie-children tr)) (ttr (aref children ind))) (declare (type (or (unsigned-byte 8) trie) ttr) - #+sbcl (type (simple-array - (or (unsigned-byte 8) trie) (30)) children) - #+ccl (type (simple-array trie (30)) children) - #+cmu (type (simple-array trie (30)) children) + #+sbcl (type trie-children-vector children) + #+ccl (type trie-children-vector children) + #+cmu (type trie-children-vector children) ) (if (eql ttr 0) (progn @@ -189,12 +190,12 @@ (ttr (aref children ind))) (declare (type (unsigned-byte 8) ind) - #+sbcl (type (simple-array (or (unsigned-byte 8) trie) (30)) children) + #+sbcl (type trie-children-vector children) #+sbcl (type (or (unsigned-byte 8) trie) ttr) ;; ccl is smart enough to not barf on a 0 pointer - #+ccl (type (simple-array trie (30)) children) + #+ccl (type trie-children-vector children) #+ccl (type trie ttr) - #+cmu (type (simple-array trie (30)) children) + #+cmu (type trie-children-vector children) #+cmu (type trie ttr) ) (and (not (eql ttr 0)) -- 1.6.2