Ignore:
Timestamp:
09/12/03 14:18:10 (19 years ago)
Author:
piso
Message:

DPB

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/ldb.lisp

    r3691 r3723  
    22;;;
    33;;; Copyright (C) 2003 Peter Graves
    4 ;;; $Id: ldb.lisp,v 1.1 2003-09-11 01:16:00 piso Exp $
     4;;; $Id: ldb.lisp,v 1.2 2003-09-12 14:16:44 piso Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    2727  (cdr bytespec))
    2828
    29 (defun ldb (bytespec n)
    30   (logand (ash n (- (byte-position bytespec)))
     29(defun ldb (bytespec integer)
     30  (logand (ash integer (- (byte-position bytespec)))
    3131          (1- (ash 1 (byte-size bytespec)))))
    3232
    33 (defun ldb-test (bytespec n)
    34   (not (zerop (ldb bytespec n))))
     33(defun ldb-test (bytespec integer)
     34  (not (zerop (ldb bytespec integer))))
     35
     36(defun dpb (newbyte bytespec integer)
     37  (let* ((size (byte-size bytespec))
     38         (position (byte-position bytespec))
     39         (mask (1- (ash 1 size))))
     40    (logior (logand integer (lognot (ash mask position)))
     41      (ash (logand newbyte mask) position))))
Note: See TracChangeset for help on using the changeset viewer.