Mention KTR_IFQ and KTR_IF_START
[dragonfly.git] / contrib / gcc-3.4 / libf2c / libF77 / lbitbits.c
1 #include "f2c.h"
2
3 #ifndef LONGBITS
4 #define LONGBITS 32
5 #endif
6
7 integer
8 lbit_bits (integer a, integer b, integer len)
9 {
10   /* Assume 2's complement arithmetic */
11
12   unsigned long x, y;
13
14   x = (unsigned long) a;
15   y = (unsigned long) -1L;
16   x >>= b;
17   y <<= len;
18   return (integer) (x & ~y);
19 }
20
21 integer
22 lbit_cshift (integer a, integer b, integer len)
23 {
24   unsigned long x, y, z;
25
26   x = (unsigned long) a;
27   if (len <= 0)
28     {
29       if (len == 0)
30         return 0;
31       goto full_len;
32     }
33   if (len >= LONGBITS)
34     {
35     full_len:
36       if (b >= 0)
37         {
38           b %= LONGBITS;
39           return (integer) (x << b | x >> (LONGBITS - b));
40         }
41       b = -b;
42       b %= LONGBITS;
43       return (integer) (x << (LONGBITS - b) | x >> b);
44     }
45   y = z = (unsigned long) -1;
46   y <<= len;
47   z &= ~y;
48   y &= x;
49   x &= z;
50   if (b >= 0)
51     {
52       b %= len;
53       return (integer) (y | (z & (x << b | x >> (len - b))));
54     }
55   b = -b;
56   b %= len;
57   return (integer) (y | (z & (x >> b | x << (len - b))));
58 }