home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / pascal / 8442 < prev    next >
Encoding:
Internet Message Format  |  1993-01-22  |  1.0 KB

  1. Path: sparky!uunet!mcsun!Germany.EU.net!ira.uka.de!news.belwue.de!news.uni-stuttgart.de!pc8.izfm.uni-stuttgart.de!uli
  2. From: uli@izfm.uni-stuttgart.de (Uli Allgeier)
  3. Newsgroups: comp.lang.pascal
  4. Subject: Re: help ??
  5. Date: 22 Jan 1993 16:40:47 GMT
  6. Organization: IZFM, University of Stuttgart
  7. Lines: 34
  8. Message-ID: <uli.59.0@izfm.uni-stuttgart.de>
  9. References: <8269@kielo.uta.fi>
  10. NNTP-Posting-Host: pc8.izfm.uni-stuttgart.de
  11.  
  12. Hi!
  13.  
  14. In article <8269@kielo.uta.fi> csfraw@vehka.cs.uta.fi (Francis Akoto) writes:
  15. >Can somebody please explain the code below
  16. >
  17. >( i.e can you write it in another way )
  18. >
  19. >-----
  20. >vi: integer ;
  21. >
  22. >     if ( vi and 1) = 1 then
  23. >    vi := vi shr 1;
  24. >        ...............
  25. >    ...............
  26. >
  27. >
  28. >for example : what happens if vi= 1 or vi = 2 etc will the if statment be true
  29. >and what is "shr".
  30.  
  31. In Turbo-Pacasl 3.0 'and' does a bit-by-bit logical and.
  32. example:
  33. 0 and 0   is   0
  34. 1 and 0   is   0
  35. 1 and 1   is   1
  36. 1 and 2   is   1
  37. 1 and 3   is   1
  38. 2 and 1   is   0
  39. 3 and 1   is   1
  40. 6 and 3   is   2
  41. and so on.
  42.  
  43. Cheers
  44.  
  45. Uli
  46.