| 
					
				 | 
			
			
				@@ -1,7 +1,12 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #![no_std] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 pub mod bloom_filter { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    pub const BITS: usize = 0x400_00000; // 128MB 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    use konst::primitive::{parse_usize, parse_u32}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    use konst::unwrap_ctx; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    use konst::option::unwrap_or; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    pub const ADDRESS_BITS: usize = unwrap_ctx!(parse_usize(unwrap_or!(option_env!("BLOOMFILTER_ADDRESS_BITS"), "30"))); // default = 0x1E = 30 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    pub const BITS: usize = 1 << ADDRESS_BITS; // default = 0x40_000_000 = 128MB 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     pub const ADDRESS_MASK: usize = BITS - 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     pub const WORD_BITS: usize = 0x8; // 8 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -9,17 +14,17 @@ pub mod bloom_filter { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     pub const ADDRESS_BITS_WORD: usize = 0x3; // log_2(0x8) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     pub const ADDRESS_MASK_WORD: usize = WORD_BITS - 1; // 0x7 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    pub const CHUNK_BITS: usize = 0x40000; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    pub const ADDRESS_BITS_CHUNK: usize = unwrap_ctx!(parse_usize(unwrap_or!(option_env!("BLOOMFILTER_ADDRESS_BITS_CHUNK"), "18"))); // default = 0x12 = 18 = log_2(32KB) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    pub const CHUNK_BITS: usize = 1 << ADDRESS_BITS_CHUNK; // default = 0x40000  = 32KB (per-cpu map value size limit) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     pub const CHUNK_BYTES: usize = CHUNK_BITS >> 0x3; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     pub const CHUNK_SIZE: usize = CHUNK_BITS >> ADDRESS_BITS_WORD; // WORD_SIZE * CHUNK_SIZE = 32Kb 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     pub type ChunkType = [WordType; CHUNK_SIZE]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    pub const ADDRESS_BITS_CHUNK: usize = 0x12; // = log_2(CHUNK_SIZE) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     pub const ADDRESS_MASK_CHUNK: usize = CHUNK_BITS - 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     pub const BUFFER_SIZE: usize = BITS >> ADDRESS_BITS_WORD; // 0x20_0000 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     pub const MAP_SIZE: usize = BITS >> ADDRESS_BITS_CHUNK; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    pub const HASH_COUNT: u32 = 10; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    pub const HASH_COUNT: u32 = unwrap_ctx!(parse_u32(unwrap_or!(option_env!("BLOOMFILTER_HASH_COUNT"), "10"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // Hashing based on jhash.h from kernel // TODO improve reference 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const HASH_INITVAL: u32 = 0xdeadbeef; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |