|
3 | 3 | public static class Arithmetic
|
4 | 4 | {
|
5 | 5 | // Sign bits for different data types
|
6 |
| - public const long SIGN_BIT_64 = -9223372036854775808; |
7 |
| - public const int SIGN_BIT_32 = -2147483648; |
8 |
| - public const short SIGN_BIT_16 = -32768; |
9 |
| - public const sbyte SIGN_BIT_8 = -128; |
| 6 | + internal const long SIGN_BIT_64 = -9223372036854775808; |
| 7 | + internal const int SIGN_BIT_32 = -2147483648; |
| 8 | + internal const short SIGN_BIT_16 = -32768; |
| 9 | + internal const sbyte SIGN_BIT_8 = -128; |
10 | 10 |
|
11 | 11 | // Ceiling function that doesn't deal with floating point values
|
12 | 12 | // these only work correctly with possitive numbers
|
13 |
| - public static ulong CeilingExact(ulong u1, ulong u2) => (u1 + u2 - 1) / u2; |
14 |
| - public static long CeilingExact(long u1, long u2) => (u1 + u2 - 1) / u2; |
15 |
| - public static uint CeilingExact(uint u1, uint u2) => (u1 + u2 - 1) / u2; |
16 |
| - public static int CeilingExact(int u1, int u2) => (u1 + u2 - 1) / u2; |
17 |
| - public static ushort CeilingExact(ushort u1, ushort u2) => (ushort)((u1 + u2 - 1) / u2); |
18 |
| - public static short CeilingExact(short u1, short u2) => (short)((u1 + u2 - 1) / u2); |
19 |
| - public static byte CeilingExact(byte u1, byte u2) => (byte)((u1 + u2 - 1) / u2); |
20 |
| - public static sbyte CeilingExact(sbyte u1, sbyte u2) => (sbyte)((u1 + u2 - 1) / u2); |
| 13 | + internal static ulong CeilingExact(ulong u1, ulong u2) => (u1 + u2 - 1) / u2; |
| 14 | + internal static long CeilingExact(long u1, long u2) => (u1 + u2 - 1) / u2; |
| 15 | + internal static uint CeilingExact(uint u1, uint u2) => (u1 + u2 - 1) / u2; |
| 16 | + internal static int CeilingExact(int u1, int u2) => (u1 + u2 - 1) / u2; |
| 17 | + internal static ushort CeilingExact(ushort u1, ushort u2) => (ushort)((u1 + u2 - 1) / u2); |
| 18 | + internal static short CeilingExact(short u1, short u2) => (short)((u1 + u2 - 1) / u2); |
| 19 | + internal static byte CeilingExact(byte u1, byte u2) => (byte)((u1 + u2 - 1) / u2); |
| 20 | + internal static sbyte CeilingExact(sbyte u1, sbyte u2) => (sbyte)((u1 + u2 - 1) / u2); |
21 | 21 |
|
22 | 22 | /// <summary>
|
23 | 23 | /// ZigZag encodes a signed integer and maps it to a unsigned integer
|
|
0 commit comments