MCPcopy Create free account
hub / github.com/docknetwork/crypto / add

Method add

utils/src/randomized_mult_checker.rs:107–125  ·  view source on GitHub ↗
(&mut self, p: G, s: G::ScalarField)

Source from the content-addressed store, hash-verified

105 }
106
107 fn add(&mut self, p: G, s: G::ScalarField) {
108 if let Some(x) = p.x() {
109 self.args
110 .entry(*x)
111 .and_modify(|(old_scalar, point)| {
112 // If the point or its negative already exists, update the scalar accordingly
113 if *point == p {
114 *old_scalar += s;
115 } else {
116 *old_scalar -= s;
117 debug_assert_eq!(point.into_group(), -p.into_group());
118 }
119 })
120 .or_insert((s, p));
121 } else {
122 // If p is a point at infinity, then it doesn't impact the result
123 debug_assert!(p.is_zero());
124 }
125 }
126}
127
128#[cfg(test)]

Callers 4

add_1Method · 0.45
add_2Method · 0.45
add_3Method · 0.45
add_manyMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected