MCPcopy Create free account
hub / github.com/ciphermodelabs/ciphercore / to_u64

Method to_u64

ciphercore-base/src/data_values.rs:575–577  ·  view source on GitHub ↗

Converts `self` to a scalar if it is a byte vector, then casts the result to `u64`. # Arguments `st` - scalar type used to interpret `self` # Result Resulting scalar cast to `u64` # Examples ``` # use ciphercore_base::data_values::Value; # use ciphercore_base::data_types::INT32; let v = Value::from_scalar(-123456, INT32).unwrap(); assert_eq!(v.to_u64(INT32).unwrap(), -123456i32 as u64); ```

(&self, st: ScalarType)

Source from the content-addressed store, hash-verified

573 /// assert_eq!(v.to_u64(INT32).unwrap(), -123456i32 as u64);
574 /// ```
575 pub fn to_u64(&self, st: ScalarType) -> Result<u64> {
576 Ok(self.to_u128(st)? as u64)
577 }
578
579 /// Converts `self` to a scalar if it is a byte vector, then cast the result to `i64`.
580 ///

Callers 12

test_extract_scalar_bitFunction · 0.45
test_well_behavedFunction · 0.45
scalar_helperFunction · 0.45
test_well_formedFunction · 0.45
add_with_overflow_helperFunction · 0.45
test_well_behavedFunction · 0.45
test_multiply_scalarsFunction · 0.45
test_multiply_negativeFunction · 0.45
overflow_helperFunction · 0.45
evaluate_nodeMethod · 0.45

Calls 1

to_u128Method · 0.45

Tested by 8

test_extract_scalar_bitFunction · 0.36
test_well_behavedFunction · 0.36
test_well_formedFunction · 0.36
test_well_behavedFunction · 0.36
test_multiply_scalarsFunction · 0.36
test_multiply_negativeFunction · 0.36