-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEAT] Bitwise 'AND' 'OR' 'XOR' Operations (#2365)
Hey @colin-ho / @jaychia : When i'm trying to Implement Daft Logic for Numeric values in src/array/ops/comparison.rs i'm getting several errors while build. I've done changes to binary_ops.rs to logical_ops() accommodate Numeric Types. Please take a look at it and let me know if i'm doing something wrong. Attached the build error i'm facing for reference [build_error.txt](https://github.com/user-attachments/files/15832189/build_error.txt) --------- Co-authored-by: Colin Ho <[email protected]>
- Loading branch information
1 parent
9b94984
commit 3af6069
Showing
17 changed files
with
349 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use crate::{ | ||
array::DataArray, | ||
datatypes::{DaftIntegerType, DaftNumericType}, | ||
}; | ||
|
||
use common_error::DaftResult; | ||
|
||
use std::ops::{BitAnd, BitOr, BitXor}; | ||
|
||
use super::DaftLogical; | ||
|
||
impl<T> DaftLogical<&DataArray<T>> for DataArray<T> | ||
where | ||
T: DaftIntegerType, | ||
<T as DaftNumericType>::Native: | ||
Ord + BitAnd<Output = T::Native> + BitOr<Output = T::Native> + BitXor<Output = T::Native>, | ||
{ | ||
type Output = DaftResult<Self>; | ||
|
||
fn and(&self, rhs: &DataArray<T>) -> Self::Output { | ||
self.binary_apply(rhs, |lhs, rhs| lhs.bitand(rhs)) | ||
} | ||
|
||
fn or(&self, rhs: &DataArray<T>) -> Self::Output { | ||
self.binary_apply(rhs, |lhs, rhs| lhs.bitor(rhs)) | ||
} | ||
|
||
fn xor(&self, rhs: &DataArray<T>) -> Self::Output { | ||
self.binary_apply(rhs, |lhs, rhs| lhs.bitxor(rhs)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.