MCPcopy Index your code
hub / github.com/bcgit/bc-java / Nat128

Class Nat128

core/src/main/java/org/bouncycastle/math/raw/Nat128.java:7–884  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5import org.bouncycastle.util.Pack;
6
7public abstract class Nat128
8{
9 private static final long M = 0xFFFFFFFFL;
10
11 public static int add(int[] x, int[] y, int[] z)
12 {
13 long c = 0;
14 c += (x[0] & M) + (y[0] & M);
15 z[0] = (int)c;
16 c >>>= 32;
17 c += (x[1] & M) + (y[1] & M);
18 z[1] = (int)c;
19 c >>>= 32;
20 c += (x[2] & M) + (y[2] & M);
21 z[2] = (int)c;
22 c >>>= 32;
23 c += (x[3] & M) + (y[3] & M);
24 z[3] = (int)c;
25 c >>>= 32;
26 return (int)c;
27 }
28
29 public static int addBothTo(int[] x, int[] y, int[] z)
30 {
31 long c = 0;
32 c += (x[0] & M) + (y[0] & M) + (z[0] & M);
33 z[0] = (int)c;
34 c >>>= 32;
35 c += (x[1] & M) + (y[1] & M) + (z[1] & M);
36 z[1] = (int)c;
37 c >>>= 32;
38 c += (x[2] & M) + (y[2] & M) + (z[2] & M);
39 z[2] = (int)c;
40 c >>>= 32;
41 c += (x[3] & M) + (y[3] & M) + (z[3] & M);
42 z[3] = (int)c;
43 c >>>= 32;
44 return (int)c;
45 }
46
47 public static int addTo(int[] x, int[] z)
48 {
49 long c = 0;
50 c += (x[0] & M) + (z[0] & M);
51 z[0] = (int)c;
52 c >>>= 32;
53 c += (x[1] & M) + (z[1] & M);
54 z[1] = (int)c;
55 c >>>= 32;
56 c += (x[2] & M) + (z[2] & M);
57 z[2] = (int)c;
58 c >>>= 32;
59 c += (x[3] & M) + (z[3] & M);
60 z[3] = (int)c;
61 c >>>= 32;
62 return (int)c;
63 }
64

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected