home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / EZY110-1.ARJ / STRUCT.ARJ / CLIB.ARJ / SETBIT.CPP < prev    next >
C/C++ Source or Header  |  1995-03-28  |  463b  |  26 lines

  1.  
  2. #include <ezycom.h>
  3.  
  4. void SetBitWord(byte Position,int Value,word &ChangeWord)
  5. {
  6.   word wd = 0x01 << Position;
  7.   if (Value)
  8.     ChangeWord = ChangeWord | wd;
  9.   else {
  10.     wd = wd ^ 0xffff;
  11.     ChangeWord = ChangeWord & wd;
  12.   }
  13. }
  14.  
  15. void SetBitByte(byte Position,int Value,byte &ChangeByte)
  16. {
  17.   byte wd = 0x01 << Position;
  18.   if (Value)
  19.     ChangeByte = ChangeByte | wd;
  20.   else {
  21.     wd = wd ^ 0xff;
  22.     ChangeByte = ChangeByte & wd;
  23.   }
  24. }
  25.  
  26.