1
1
//! Types used within CipherCore and related functions.
2
- use crate :: constants;
2
+ use crate :: constants:: type_size_limit_constants ;
3
3
use crate :: errors:: CiphercoreBaseError ;
4
4
use crate :: errors:: Result ;
5
5
use serde:: { Deserialize , Serialize } ;
@@ -133,8 +133,8 @@ impl ScalarType {
133
133
if let Some ( m) = self . modulus {
134
134
//Currently our evaluator only supports bit_size = 1,8,16,32,64
135
135
let supported_modulus = vec ! [ TWO , TWO . pow( 8 ) , TWO . pow( 16 ) , TWO . pow( 32 ) ] ;
136
- let supported =
137
- constants :: NON_STANDARD_SCALAR_LEN_SUPPORT || supported_modulus. contains ( & m) ;
136
+ let supported = type_size_limit_constants :: NON_STANDARD_SCALAR_LEN_SUPPORT
137
+ || supported_modulus. contains ( & m) ;
138
138
supported && ( m > 2 || ( m == 2 && !self . signed ) )
139
139
} else {
140
140
true
@@ -1202,7 +1202,7 @@ pub(super) fn get_size_estimation_in_bits(t: Type) -> Result<u64> {
1202
1202
}
1203
1203
} ;
1204
1204
result
1205
- . checked_add ( constants :: TYPE_MEMORY_OVERHEAD )
1205
+ . checked_add ( type_size_limit_constants :: TYPE_MEMORY_OVERHEAD )
1206
1206
. ok_or_else ( || runtime_error ! ( "add overflow!" ) )
1207
1207
}
1208
1208
@@ -1253,7 +1253,7 @@ pub(super) fn get_size_estimation_in_bits(t: Type) -> Result<u64> {
1253
1253
pub fn get_types_vector ( t : Type ) -> Result < Vec < TypePointer > > {
1254
1254
match t {
1255
1255
Type :: Vector ( length, element_type) => {
1256
- if length > constants :: TYPES_VECTOR_LENGTH_LIMIT as u64 {
1256
+ if length > type_size_limit_constants :: TYPES_VECTOR_LENGTH_LIMIT as u64 {
1257
1257
return Err ( runtime_error ! (
1258
1258
"Vector length is greater than TYPES_VECTOR_LENGTH_LIMIT!"
1259
1259
) ) ;
@@ -1266,7 +1266,7 @@ pub fn get_types_vector(t: Type) -> Result<Vec<TypePointer>> {
1266
1266
}
1267
1267
Type :: Tuple ( types) => {
1268
1268
let length = types. len ( ) ;
1269
- if length > constants :: TYPES_VECTOR_LENGTH_LIMIT {
1269
+ if length > type_size_limit_constants :: TYPES_VECTOR_LENGTH_LIMIT {
1270
1270
return Err ( runtime_error ! (
1271
1271
"Tuple length is greater than TYPES_VECTOR_LENGTH_LIMIT!"
1272
1272
) ) ;
@@ -1279,7 +1279,7 @@ pub fn get_types_vector(t: Type) -> Result<Vec<TypePointer>> {
1279
1279
}
1280
1280
Type :: NamedTuple ( names_types) => {
1281
1281
let length = names_types. len ( ) ;
1282
- if length > constants :: TYPES_VECTOR_LENGTH_LIMIT {
1282
+ if length > type_size_limit_constants :: TYPES_VECTOR_LENGTH_LIMIT {
1283
1283
return Err ( runtime_error ! (
1284
1284
"NamedTuple length is greater than TYPES_VECTOR_LENGTH_LIMIT!"
1285
1285
) ) ;
0 commit comments