Last change
on this file since 1 was
1,
checked in by lnalod, 15 years ago
|
Initial import of YAO sources
|
File size:
542 bytes
|
Line | |
---|
1 | using System; |
---|
2 | internal class SupportClass |
---|
3 | { |
---|
4 | public static int URShift(int number, int bits) |
---|
5 | { |
---|
6 | if ( number >= 0) |
---|
7 | return number >> bits; |
---|
8 | else |
---|
9 | return (number >> bits) + (2 << ~bits); |
---|
10 | } |
---|
11 | |
---|
12 | public static int URShift(int number, long bits) |
---|
13 | { |
---|
14 | return URShift(number, (int)bits); |
---|
15 | } |
---|
16 | |
---|
17 | public static long URShift(long number, int bits) |
---|
18 | { |
---|
19 | if ( number >= 0) |
---|
20 | return number >> bits; |
---|
21 | else |
---|
22 | return (number >> bits) + (2L << ~bits); |
---|
23 | } |
---|
24 | |
---|
25 | public static long URShift(long number, long bits) |
---|
26 | { |
---|
27 | return URShift(number, (int)bits); |
---|
28 | } |
---|
29 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.