mirror of
https://github.com/zama-ai/tfhe-rs.git
synced 2026-01-08 06:13:58 -05:00
chore(tfhe): remove dbg! macro calls and add a Makefile check for it
This commit is contained in:
8
Makefile
8
Makefile
@@ -405,6 +405,10 @@ ci_test_web_js_api_parallel: build_web_js_api_parallel
|
|||||||
no_tfhe_typo:
|
no_tfhe_typo:
|
||||||
@./scripts/no_tfhe_typo.sh
|
@./scripts/no_tfhe_typo.sh
|
||||||
|
|
||||||
|
.PHONY: no_dbg_log # Check we did not leave dbg macro calls in the rust code
|
||||||
|
no_dbg_log:
|
||||||
|
@./scripts/no_dbg_calls.sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Benchmarks
|
# Benchmarks
|
||||||
#
|
#
|
||||||
@@ -509,10 +513,10 @@ sha256_bool: install_rs_check_toolchain
|
|||||||
--features=$(TARGET_ARCH_FEATURE),boolean
|
--features=$(TARGET_ARCH_FEATURE),boolean
|
||||||
|
|
||||||
.PHONY: pcc # pcc stands for pre commit checks
|
.PHONY: pcc # pcc stands for pre commit checks
|
||||||
pcc: no_tfhe_typo check_fmt doc clippy_all check_compile_tests
|
pcc: no_tfhe_typo no_dbg_log check_fmt doc clippy_all check_compile_tests
|
||||||
|
|
||||||
.PHONY: fpcc # pcc stands for pre commit checks, the f stands for fast
|
.PHONY: fpcc # pcc stands for pre commit checks, the f stands for fast
|
||||||
fpcc: no_tfhe_typo check_fmt doc clippy_fast check_compile_tests
|
fpcc: no_tfhe_typo no_dbg_log check_fmt doc clippy_fast check_compile_tests
|
||||||
|
|
||||||
.PHONY: conformance # Automatically fix problems that can be fixed
|
.PHONY: conformance # Automatically fix problems that can be fixed
|
||||||
conformance: fmt
|
conformance: fmt
|
||||||
|
|||||||
20
scripts/no_dbg_calls.sh
Executable file
20
scripts/no_dbg_calls.sh
Executable file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
THIS_SCRIPT_NAME="$(basename "$0")"
|
||||||
|
|
||||||
|
TMP_FILE="$(mktemp)"
|
||||||
|
|
||||||
|
COUNT="$(git grep -rniI "dbg!" . | grep -v "${THIS_SCRIPT_NAME}" | \
|
||||||
|
tee "${TMP_FILE}" | wc -l | tr -d '[:space:]')"
|
||||||
|
|
||||||
|
cat "${TMP_FILE}"
|
||||||
|
rm -rf "${TMP_FILE}"
|
||||||
|
|
||||||
|
if [[ "${COUNT}" == "0" ]]; then
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "dbg macro calls detected, see output log above"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
@@ -601,8 +601,6 @@ impl ServerKey {
|
|||||||
let shift_within_block = n % num_bits_in_message;
|
let shift_within_block = n % num_bits_in_message;
|
||||||
let num_blocks = ct.blocks.len();
|
let num_blocks = ct.blocks.len();
|
||||||
|
|
||||||
dbg!(rotations);
|
|
||||||
|
|
||||||
// rotate right as the blocks are from LSB to MSB
|
// rotate right as the blocks are from LSB to MSB
|
||||||
ct.blocks.rotate_right(rotations);
|
ct.blocks.rotate_right(rotations);
|
||||||
|
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ impl U256 {
|
|||||||
pub fn leading_zeros(self) -> u32 {
|
pub fn leading_zeros(self) -> u32 {
|
||||||
// iter from msb to lsb
|
// iter from msb to lsb
|
||||||
for (i, word) in self.0.iter().copied().rev().enumerate() {
|
for (i, word) in self.0.iter().copied().rev().enumerate() {
|
||||||
let leading_zeros = dbg!(word.leading_zeros());
|
let leading_zeros = word.leading_zeros();
|
||||||
if leading_zeros != u64::BITS {
|
if leading_zeros != u64::BITS {
|
||||||
return (i as u32 * u64::BITS) + leading_zeros;
|
return (i as u32 * u64::BITS) + leading_zeros;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user