/[cmucl]/src/compiler/bit-util.lisp
ViewVC logotype

Contents of /src/compiler/bit-util.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (show annotations)
Tue Apr 20 17:57:46 2010 UTC (3 years, 11 months ago) by rtoy
Branch: MAIN
CVS Tags: sparc-tramp-assem-base, release-20b-pre1, release-20b-pre2, sparc-tramp-assem-2010-07-19, GIT-CONVERSION, cross-sol-x86-merged, RELEASE_20b, cross-sol-x86-base, snapshot-2010-12, snapshot-2010-11, snapshot-2011-09, snapshot-2011-06, snapshot-2011-07, snapshot-2011-04, snapshot-2011-02, snapshot-2011-03, snapshot-2011-01, snapshot-2010-05, snapshot-2010-07, snapshot-2010-06, snapshot-2010-08, cross-sol-x86-2010-12-20, cross-sparc-branch-base, HEAD
Branch point for: cross-sparc-branch, RELEASE-20B-BRANCH, sparc-tramp-assem-branch, cross-sol-x86-branch
Changes since 1.8: +2 -2 lines
Change uses of _"foo" to (intl:gettext "foo").  This is because slime
may get confused with source locations if the reader macros are
installed.
1 ;;; -*- Package: C; Log: C.Log -*-
2 ;;;
3 ;;; **********************************************************************
4 ;;; This code was written as part of the CMU Common Lisp project at
5 ;;; Carnegie Mellon University, and has been placed in the public domain.
6 ;;;
7 (ext:file-comment
8 "$Header: /tiger/var/lib/cvsroots/cmucl/src/compiler/bit-util.lisp,v 1.9 2010/04/20 17:57:46 rtoy Rel $")
9 ;;;
10 ;;; **********************************************************************
11 ;;;
12 ;;; Bit-vector hacking utilities, potentially implementation-dependent for
13 ;;; speed.
14 ;;;
15 ;;; Written by Rob MacLachlan
16 ;;;
17 (in-package "C")
18 (intl:textdomain "cmucl")
19
20 (declaim (inline clear-bit-vector set-bit-vector bit-vector-replace
21 bit-vector-copy))
22
23 ;;; Clear-Bit-Vector -- Interface
24 ;;;
25 ;;; Clear a bit-vector to zeros.
26 ;;;
27 (defun clear-bit-vector (vec)
28 (declare (type simple-bit-vector vec))
29 (do ((i vm:vector-data-offset (1+ i))
30 (end (+ vm:vector-data-offset
31 (ash (+ (length vec) (1- vm:word-bits))
32 (- (1- (integer-length vm:word-bits)))))))
33 ((= i end) vec)
34 (setf (kernel:%raw-bits vec i) 0)))
35
36 (defmacro clear-ltn-bit-vector (vec)
37 (once-only ((n-vec vec))
38 (collect ((res))
39 (do ((i local-tn-limit (- i vm:word-bits))
40 (word vm:vector-data-offset (1+ word)))
41 ((<= i 0)
42 (unless (zerop i)
43 (error (intl:gettext "local-tn-limit not a vm:word-bits multiple."))))
44 (res `(setf (kernel:%raw-bits ,n-vec ,word) 0)))
45 `(progn ,@(res) ,n-vec))))
46
47 ;;; Set-Bit-Vector -- Interface
48 ;;;
49 ;;; Fill a bit vector with ones.
50 ;;;
51 (defun set-bit-vector (vec)
52 (declare (type simple-bit-vector vec))
53 (bit-orc2 vec vec t))
54
55
56 ;;; Bit-Vector-Replace -- Interface
57 ;;;
58 ;;; Replace the bits in To with the bits in From.
59 ;;;
60 (defun bit-vector-replace (to from)
61 (declare (type simple-bit-vector to from))
62 (bit-ior from from to))
63
64
65 ;;; Bit-Vector-Copy -- Interface
66 ;;;
67 ;;; Copy a bit-vector.
68 ;;;
69 (defun bit-vector-copy (vec)
70 (declare (type simple-bit-vector vec))
71 (bit-ior vec vec (make-array (length vec) :element-type 'bit)))

  ViewVC Help
Powered by ViewVC 1.1.5