File: chksum.h

package info (click to toggle)
btoa 5.2.1-5
  • links: PTS
  • area: non-free
  • in suites: potato
  • size: 80 kB
  • ctags: 57
  • sloc: ansic: 909; makefile: 65
file content (24 lines) | stat: -rw-r--r-- 805 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* chksum.h */
/* calcchecksum() was converted to a macro for effectivity reasons. */
/* Don't (!!) give it an argument that has to be evaluated. This    */
/* is guaranteed to slow it down.                                   */

/* Update file checksums. */

#define calcchecksum(ch)        \
{                               \
  extern LONG Ceor, Csum, Crot; \
                                \
  Ceor ^= ch;                   \
  Csum += ch + 1;               \
                                \
  if (Crot & 0x80000000L)       \
  {                             \
    Crot <<= 1;                 \
    Crot ++;                    \
  }                             \
  else                          \
    Crot <<= 1;                 \
                                \
  Crot += ch;                   \
}