This file is indexed.

/usr/share/acl2-4.3/books/unicode/combine.lisp is in acl2-books-source 4.3-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
;; Processing Unicode Files with ACL2
;; Copyright (C) 2005-2006 by Jared Davis <jared@cs.utexas.edu>
;;
;; 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., 59 Temple
;; Place - Suite 330, Boston, MA 02111-1307, USA.


(in-package "ACL2")
(set-verify-guards-eagerness 2)

(include-book "sign-byte")
(local (include-book "unsigned-byte-listp"))
(local (include-book "signed-byte-listp"))

(defun combine16u (x1 x2)
  "Given unsigned bytes x1 and x2, compute (x1 << 8) | x2, interpreted
   as a 16-bit unsigned integer."
  (declare (type (unsigned-byte 8) x1)
           (type (unsigned-byte 8) x2))
  (logior (ash x1 8) x2))

(defthm combine16u-unsigned-byte
  (implies (and (force (unsigned-byte-p 8 x1))
                (force (unsigned-byte-p 8 x2)))
           (unsigned-byte-p 16 (combine16u x1 x2))))

(in-theory (disable combine16u))


(defun combine16s (x1 x2)
  "Given unsigned bytes x1 and x2, compute (x1 << 8) | x2, interpreted
   as a 16-bit signed integer."
  (declare (type (unsigned-byte 8) x1)
           (type (unsigned-byte 8) x2))
  (logior (ash (sign-byte x1) 8)
          x2))

(defthm combine16s-signed-byte
  (implies (and (force (unsigned-byte-p 8 x1))
                (force (unsigned-byte-p 8 x2)))
           (signed-byte-p 16 (combine16s x1 x2))))

(in-theory (disable combine16s))


(defun combine32u (x1 x2 x3 x4)
  "Given unsigned bytes x1, x2, x3, and x4, compute
     (x1 << 24) | (x2 << 16) | (x3 << 8) | x4
  and interpret the result as a 32-bit unsigned integer."
  (declare (type (unsigned-byte 8) x1)
           (type (unsigned-byte 8) x2)
           (type (unsigned-byte 8) x3)
           (type (unsigned-byte 8) x4))
  (logior (ash x1 24)
          (ash x2 16)
          (ash x3 8)
          x4))

(defthm combine32u-unsigned-byte
  (implies (and (force (unsigned-byte-p 8 x1))
                (force (unsigned-byte-p 8 x2))
                (force (unsigned-byte-p 8 x3))
                (force (unsigned-byte-p 8 x4)))
           (unsigned-byte-p 32 (combine32u x1 x2 x3 x4))))

(in-theory (disable combine32u))

(defun combine32s (x1 x2 x3 x4)
  "Given unsigned bytes x1, x2, x3, and x4, compute
     (x1 << 24) | (x2 << 16) | (x3 << 8) | x4
   and interpret the result as an 32-bit signed integer."
  (declare (type (unsigned-byte 8) x1)
           (type (unsigned-byte 8) x2)
           (type (unsigned-byte 8) x3)
           (type (unsigned-byte 8) x4))
  (logior (ash (sign-byte x1) 24)
          (ash x2 16)
          (ash x3 8)
          x4))

(defthm combine32s-signed-byte
  (implies (and (force (unsigned-byte-p 8 x1))
                (force (unsigned-byte-p 8 x2))
                (force (unsigned-byte-p 8 x3))
                (force (unsigned-byte-p 8 x4)))
           (signed-byte-p 32 (combine32s x1 x2 x3 x4)))
  :hints(("Goal" :use ((:instance signed-byte-p-logior
                                  (size 32)
                                  (x (ash (sign-byte x1) 24))
                                  (y (logior (ash x2 16)
                                             (ash x3 8)
                                             x4)))
                       (:instance unsigned-to-signed-promote
                                  (size1 24)
                                  (size2 32)
                                  (x (logior (ash x2 16)
                                             (ash x3 8)
                                             x4)))))))

(in-theory (disable combine32s))