;;; Lisplab, vector2-integer-functions.lisp ;;; Level2 integer functions ;;; Copyright (C) 2012 Joern Inge Vestgaarden ;;; ;;; This program is free software; you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 2 of the License, or ;;; (at your option) any later version. ;;; ;;; This program is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License along ;;; with this program; if not, write to the Free Software Foundation, Inc., ;;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. (in-package :lisplab) (defmacro def-unsigned-integer-methods (matrix-type) (let ((a (gensym "a")) (b (gensym "b")) (c (gensym "c"))) `(progn (defmethod .not ((,a ,matrix-type)) (let ((,b (mcreate ,a))) (ub8-not (vector-store ,a) (vector-store ,b)) ,b)) (defmethod .and ((,a ,matrix-type) (,b ,matrix-type)) (let ((,c (mcreate ,a))) (ub8-ub8-and (vector-store ,a) (vector-store ,b) (vector-store ,c)) ,c)) (defmethod .and ((,a ,matrix-type) (,b integer)) (let ((,c (mcreate ,a))) (ub8-int-and (vector-store ,a) ,b (vector-store ,c)) ,c)) (defmethod .and ((,b integer) (,a ,matrix-type)) (let ((,c (mcreate ,a))) (ub8-int-and (vector-store ,a) ,b (vector-store ,c)) ,c)) (defmethod .nand ((,a ,matrix-type) (,b ,matrix-type)) (let ((,c (mcreate ,a))) (ub8-ub8-nand (vector-store ,a) (vector-store ,b) (vector-store ,c)) ,c)) (defmethod .nand ((,a ,matrix-type) (,b integer)) (let ((,c (mcreate ,a))) (ub8-int-nand (vector-store ,a) ,b (vector-store ,c)) ,c)) (defmethod .nand ((,b integer) (,a ,matrix-type)) (let ((,c (mcreate ,a))) (ub8-int-nand (vector-store ,a) ,b (vector-store ,c)) ,c)) (defmethod .or ((,a ,matrix-type) (,b ,matrix-type)) (let ((,c (mcreate ,a))) (ub8-ub8-or (vector-store ,a) (vector-store ,b) (vector-store ,c)) ,c)) (defmethod .or ((,a ,matrix-type) (,b integer)) (let ((,c (mcreate ,a))) (ub8-int-or (vector-store ,a) ,b (vector-store ,c)) ,c)) (defmethod .or ((,b integer) (,a ,matrix-type)) (let ((,c (mcreate ,a))) (ub8-int-or (vector-store ,a) ,b (vector-store ,c)) ,c)) (defmethod .nor ((,a ,matrix-type) (,b ,matrix-type)) (let ((,c (mcreate ,a))) (ub8-ub8-nor (vector-store ,a) (vector-store ,b) (vector-store ,c)) ,c)) (defmethod .nor ((,a ,matrix-type) (,b integer)) (let ((,c (mcreate ,a))) (ub8-int-nor (vector-store ,a) ,b (vector-store ,c)) ,c)) (defmethod .nor ((,b integer) (,a ,matrix-type)) (let ((,c (mcreate ,a))) (ub8-int-nor (vector-store ,a) ,b (vector-store ,c)) ,c)) (defmethod .xor ((,a ,matrix-type) (,b ,matrix-type)) (let ((,c (mcreate ,a))) (ub8-ub8-xor (vector-store ,a) (vector-store ,b) (vector-store ,c)) ,c)) (defmethod .xor ((,a ,matrix-type) (,b integer)) (let ((,c (mcreate ,a))) (ub8-int-xor (vector-store ,a) ,b (vector-store ,c)) ,c)) (defmethod .xor ((,b integer) (,a ,matrix-type)) (let ((,c (mcreate ,a))) (ub8-int-xor (vector-store ,a) ,b (vector-store ,c)) ,c)) ))) (def-unsigned-integer-methods matrix-ub8 )