@@ -20,11 +20,8 @@ use crate::util::bit_util;
2020#[ cfg( feature = "simd" ) ]
2121use packed_simd:: u8x64;
2222
23- use std:: ops:: { BitAnd , BitOr , Not } ;
24-
2523#[ cfg( feature = "avx512" ) ]
2624use crate :: arch:: avx512:: * ;
27- use crate :: error:: { ArrowError , Result } ;
2825use crate :: util:: bit_util:: ceil;
2926#[ cfg( any( feature = "simd" , feature = "avx512" ) ) ]
3027use std:: borrow:: BorrowMut ;
@@ -37,7 +34,7 @@ use super::{Buffer, MutableBuffer};
3734/// Contrary to the non-simd version `bitwise_bin_op_helper`, the offset and length is specified in bytes
3835/// and this version does not support operations starting at arbitrary bit offsets.
3936#[ cfg( simd) ]
40- pub fn bitwise_bin_op_simd_helper < F_SIMD , F_SCALAR > (
37+ fn bitwise_bin_op_simd_helper < F_SIMD , F_SCALAR > (
4138 left : & Buffer ,
4239 left_offset : usize ,
4340 right : & Buffer ,
8683/// Contrary to the non-simd version `bitwise_unary_op_helper`, the offset and length is specified in bytes
8784/// and this version does not support operations starting at arbitrary bit offsets.
8885#[ cfg( simd) ]
89- pub fn bitwise_unary_op_simd_helper < F_SIMD , F_SCALAR > (
86+ fn bitwise_unary_op_simd_helper < F_SIMD , F_SCALAR > (
9087 left : & Buffer ,
9188 left_offset : usize ,
9289 len : usize ,
@@ -125,7 +122,7 @@ where
125122
126123/// Apply a bitwise operation `op` to two inputs and return the result as a Buffer.
127124/// The inputs are treated as bitmaps, meaning that offsets and length are specified in number of bits.
128- pub fn bitwise_bin_op_helper < F > (
125+ fn bitwise_bin_op_helper < F > (
129126 left : & Buffer ,
130127 left_offset_in_bits : usize ,
131128 right : & Buffer ,
@@ -157,7 +154,7 @@ where
157154
158155/// Apply a bitwise operation `op` to one input and return the result as a Buffer.
159156/// The input is treated as a bitmap, meaning that offset and length are specified in number of bits.
160- pub fn bitwise_unary_op_helper < F > (
157+ pub ( super ) fn bitwise_unary_op_helper < F > (
161158 left : & Buffer ,
162159 offset_in_bits : usize ,
163160 len_in_bits : usize ,
@@ -189,7 +186,7 @@ where
189186}
190187
191188#[ cfg( all( target_arch = "x86_64" , feature = "avx512" ) ) ]
192- pub fn buffer_bin_and (
189+ pub ( crate ) fn buffer_bin_and (
193190 left : & Buffer ,
194191 left_offset_in_bits : usize ,
195192 right : & Buffer ,
@@ -247,7 +244,7 @@ pub fn buffer_bin_and(
247244}
248245
249246#[ cfg( all( feature = "simd" , not( feature = "avx512" ) ) ) ]
250- pub fn buffer_bin_and (
247+ pub ( crate ) fn buffer_bin_and (
251248 left : & Buffer ,
252249 left_offset_in_bits : usize ,
253250 right : & Buffer ,
@@ -282,7 +279,7 @@ pub fn buffer_bin_and(
282279// Note: do not target specific features like x86 without considering
283280// other targets like wasm32, as those would fail to build
284281#[ cfg( all( not( any( feature = "simd" , feature = "avx512" ) ) ) ) ]
285- pub fn buffer_bin_and (
282+ pub ( crate ) fn buffer_bin_and (
286283 left : & Buffer ,
287284 left_offset_in_bits : usize ,
288285 right : & Buffer ,
@@ -300,7 +297,7 @@ pub fn buffer_bin_and(
300297}
301298
302299#[ cfg( all( target_arch = "x86_64" , feature = "avx512" ) ) ]
303- pub fn buffer_bin_or (
300+ pub ( crate ) fn buffer_bin_or (
304301 left : & Buffer ,
305302 left_offset_in_bits : usize ,
306303 right : & Buffer ,
@@ -358,7 +355,7 @@ pub fn buffer_bin_or(
358355}
359356
360357#[ cfg( all( feature = "simd" , not( feature = "avx512" ) ) ) ]
361- pub fn buffer_bin_or (
358+ pub ( crate ) fn buffer_bin_or (
362359 left : & Buffer ,
363360 left_offset_in_bits : usize ,
364361 right : & Buffer ,
@@ -391,7 +388,7 @@ pub fn buffer_bin_or(
391388}
392389
393390#[ cfg( all( not( any( feature = "simd" , feature = "avx512" ) ) ) ) ]
394- pub fn buffer_bin_or (
391+ pub ( crate ) fn buffer_bin_or (
395392 left : & Buffer ,
396393 left_offset_in_bits : usize ,
397394 right : & Buffer ,
@@ -408,7 +405,7 @@ pub fn buffer_bin_or(
408405 )
409406}
410407
411- pub fn buffer_unary_not (
408+ pub ( crate ) fn buffer_unary_not (
412409 left : & Buffer ,
413410 offset_in_bits : usize ,
414411 len_in_bits : usize ,
@@ -430,43 +427,3 @@ pub fn buffer_unary_not(
430427 bitwise_unary_op_helper ( & left, offset_in_bits, len_in_bits, |a| !a)
431428 }
432429}
433-
434- impl < ' a , ' b > BitAnd < & ' b Buffer > for & ' a Buffer {
435- type Output = Result < Buffer > ;
436-
437- fn bitand ( self , rhs : & ' b Buffer ) -> Result < Buffer > {
438- if self . len ( ) != rhs. len ( ) {
439- return Err ( ArrowError :: ComputeError (
440- "Buffers must be the same size to apply Bitwise AND." . to_string ( ) ,
441- ) ) ;
442- }
443-
444- let len_in_bits = self . len ( ) * 8 ;
445- Ok ( buffer_bin_and ( & self , 0 , & rhs, 0 , len_in_bits) )
446- }
447- }
448-
449- impl < ' a , ' b > BitOr < & ' b Buffer > for & ' a Buffer {
450- type Output = Result < Buffer > ;
451-
452- fn bitor ( self , rhs : & ' b Buffer ) -> Result < Buffer > {
453- if self . len ( ) != rhs. len ( ) {
454- return Err ( ArrowError :: ComputeError (
455- "Buffers must be the same size to apply Bitwise OR." . to_string ( ) ,
456- ) ) ;
457- }
458-
459- let len_in_bits = self . len ( ) * 8 ;
460-
461- Ok ( buffer_bin_or ( & self , 0 , & rhs, 0 , len_in_bits) )
462- }
463- }
464-
465- impl Not for & Buffer {
466- type Output = Buffer ;
467-
468- fn not ( self ) -> Buffer {
469- let len_in_bits = self . len ( ) * 8 ;
470- buffer_unary_not ( & self , 0 , len_in_bits)
471- }
472- }
0 commit comments