This is an automated email from the ASF dual-hosted git repository.
agrove pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-comet.git
The following commit(s) were added to refs/heads/main by this push:
new 4a0631b chore: Remove unused functions (#301)
4a0631b is described below
commit 4a0631b82786d072b80c0afa7985cdc079d5f9ca
Author: KAZUYUKI TANIMURA <[email protected]>
AuthorDate: Tue Apr 23 07:38:43 2024 -0700
chore: Remove unused functions (#301)
---
core/src/common/bit.rs | 39 ---------------------------------------
1 file changed, 39 deletions(-)
diff --git a/core/src/common/bit.rs b/core/src/common/bit.rs
index f736347..2cd1871 100644
--- a/core/src/common/bit.rs
+++ b/core/src/common/bit.rs
@@ -142,18 +142,6 @@ macro_rules! read_num_be_bytes {
}};
}
-/// Converts value `val` of type `T` to a byte vector, by reading `num_bytes`
from `val`.
-/// NOTE: if `val` is less than the size of `T` then it can be truncated.
-#[inline]
-pub fn convert_to_bytes<T>(val: &T, num_bytes: usize) -> Vec<u8>
-where
- T: ?Sized + AsBytes,
-{
- let mut bytes: Vec<u8> = vec![0; num_bytes];
- memcpy_value(val.as_bytes(), num_bytes, &mut bytes);
- bytes
-}
-
#[inline]
pub fn memcpy(source: &[u8], target: &mut [u8]) {
debug_assert!(target.len() >= source.len(), "Copying from source to target
is not possible. Source has {} bytes but target has {} bytes", source.len(),
target.len());
@@ -203,10 +191,6 @@ pub fn trailing_bits(v: u64, num_bits: usize) -> u64 {
(v << n) >> n
}
-pub fn set_bit_value(bits: &mut [u8], i: usize, val: bool) {
- bits[i / 8] |= (val as u8) << (i % 8);
-}
-
#[inline]
pub fn set_bit(bits: &mut [u8], i: usize) {
bits[i / 8] |= 1 << (i % 8);
@@ -257,17 +241,6 @@ pub fn set_bits(bits: &mut [u8], offset: usize, length:
usize) {
}
}
-/// Returns the minimum number of bits needed to represent the value 'x'
-#[inline]
-pub fn num_required_bits(x: u64) -> usize {
- for i in (0..64).rev() {
- if x & (1u64 << i) != 0 {
- return i + 1;
- }
- }
- 0
-}
-
#[inline(always)]
pub fn mix_hash(lower: u64, upper: u64) -> u64 {
let hash = (17 * 37u64).wrapping_add(lower);
@@ -1170,18 +1143,6 @@ mod tests {
}
}
- #[test]
- fn test_num_required_bits() {
- assert_eq!(num_required_bits(0), 0);
- assert_eq!(num_required_bits(1), 1);
- assert_eq!(num_required_bits(2), 2);
- assert_eq!(num_required_bits(4), 3);
- assert_eq!(num_required_bits(8), 4);
- assert_eq!(num_required_bits(10), 4);
- assert_eq!(num_required_bits(12), 4);
- assert_eq!(num_required_bits(16), 5);
- }
-
#[test]
fn test_get_bit() {
// 00001101
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]