|
|
1.1 ! root 1: .ds ZZ DEVELOPMENT PACKAGE ! 2: .TH ROL 3L "630 MTG" ! 3: .XE "rol()" ! 4: .XE "ror()" ! 5: .SH NAME ! 6: rol, ror \- rotate bits ! 7: .SH SYNOPSIS ! 8: .B int rol (x, n) ! 9: .sp ! 10: .B int ror (x, n) ! 11: .sp ! 12: .B int x, n; ! 13: .SH DESCRIPTION ! 14: The ! 15: .I rol ! 16: function ! 17: returns ! 18: .I x ! 19: logically bit-rotated left by ! 20: .I n. ! 21: .PP ! 22: The ! 23: .I ror ! 24: function ! 25: returns ! 26: .I x ! 27: logically bit-rotated right by ! 28: .I n. ! 29: .SH EXAMPLE ! 30: The following subroutine can be used to determine whether a Point ! 31: .I p ! 32: in a Bitmap ! 33: .I b ! 34: is on or off (returning 1 or 0, respectively). ! 35: .PP ! 36: .RS 3 ! 37: .nf ! 38: .ft CM ! 39: #include <dmd.h> ! 40: ! 41: pixel (b, p) ! 42: Bitmap *b; ! 43: Point p; ! 44: { ! 45: Word *w; ! 46: ! 47: w = addr (b, p); ! 48: return ( (rol (*w, p.x%\s-1WORDSIZE\s+1) ! 49: & \s-1FIRSTBIT\s+1)==\s-1FIRSTBIT\s+1); ! 50: } ! 51: \fR ! 52: .fi ! 53: .RE ! 54: .PP ! 55: This routine is implemented differently in ! 56: .IR addr (3R). ! 57: .SH SEE ALSO ! 58: addr(3R). ! 59:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.