Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: verify NTT size is a power of two #374

Merged
merged 2 commits into from
Feb 14, 2024
Merged

Conversation

yshekel
Copy link
Collaborator

@yshekel yshekel commented Feb 14, 2024

No description provided.

@yshekel yshekel force-pushed the yshekel/ntt_assert_power_of_two branch from 4767111 to 0c083c0 Compare February 14, 2024 12:43
<< "NTT size is too large for the domain. Consider generating your domain with a higher order root of unity"
<< '\n';
throw -1;
std::cerr << "[ERROR] NTT size=" << size
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use THROW_ICICLE_ERR(
IcicleError_t::InvalidArgument, "error message

Copy link
Collaborator Author

@yshekel yshekel Feb 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not sure since we don't catch it and there is no real reason to crash user app.
Do you think it's better to throw exceptions for wrong user input?


int logn = int(log2(size));
const bool is_size_power_of_two = size == (1 << logn);
if (!is_size_power_of_two) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@yshekel yshekel requested a review from vhnatyk February 14, 2024 13:50
@yshekel yshekel force-pushed the yshekel/ntt_assert_power_of_two branch 5 times, most recently from afaa5a9 to d37869e Compare February 14, 2024 14:01
@yshekel yshekel force-pushed the yshekel/ntt_assert_power_of_two branch from d37869e to 03e9057 Compare February 14, 2024 14:02
@yshekel yshekel changed the title fix: verify NTT size is a power of two. return error otherwise. fix: verify NTT size is a power of two Feb 14, 2024
@yshekel yshekel merged commit 0d70a0c into dev Feb 14, 2024
14 checks passed
@yshekel yshekel deleted the yshekel/ntt_assert_power_of_two branch February 14, 2024 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants