home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / lisp / 2259 < prev    next >
Encoding:
Internet Message Format  |  1992-08-19  |  1.4 KB

  1. Path: sparky!uunet!ogicse!das-news.harvard.edu!cantaloupe.srv.cs.cmu.edu!crabapple.srv.cs.cmu.edu!andrew.cmu.edu!<UNAUTHENTICATED>+
  2. From: William.Lott@cs.cmu.edu
  3. Newsgroups: comp.lang.lisp
  4. Subject: Re: Calling C function from LCL
  5. Message-ID: <4eYpN3W00jeiEkhC8z@cs.cmu.edu>
  6. Date: 20 Aug 92 00:22:27 GMT
  7. Article-I.D.: cs.4eYpN3W00jeiEkhC8z
  8. References: <Bt8G1E.229@iai.kfk.de>
  9.     <16u3jhINN9m1@early-bird.think.com>
  10. Organization: Carnegie Mellon, Pittsburgh, PA
  11. Lines: 19
  12. In-Reply-To: <16u3jhINN9m1@early-bird.think.com>
  13.  
  14. barmar@think.com (Barry Margolin) writes:
  15. > Fixnums have the type tags 00 (positive fixnum) and 11 (negative fixnum);
  16. > this has the property that the tagged value is the result of an arithmetic
  17. > shift of the untagged value, which allows them to be added without
  18. > untagging, and multiplied by shifting the result rather than the arguments.
  19.  
  20. Are those tags on the low end or high end of the word?  If they are on
  21. the low end, then how does adding two negative fixnums result in
  22. anything useful (xxx11 + xxx11 = xxx10)?  If they are on the high end,
  23. where does the shift come in?
  24.  
  25. We [CMU Common Lisp, that is] use the low three bits as a type-tag,
  26. but have 000 for even fixnums and 100 for odd fixnums.  In other
  27. words, if the low two bits are 00 then it is a fixnum with the value
  28. in the upper 30 bits.  The implicit multiplication by 4 is handy when
  29. accessing arrays of word (4 byte) sized objects: it's pre-scaled.
  30.  
  31. -William Lott
  32. CMU Common Lisp Group
  33.