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

模加法计算时可能存在问题 #2

Open
chxv opened this issue Apr 26, 2020 · 0 comments
Open

模加法计算时可能存在问题 #2

chxv opened this issue Apr 26, 2020 · 0 comments

Comments

@chxv
Copy link

chxv commented Apr 26, 2020

ZUC.cpp 第58行开始的 c mod (2^31-1)

unsigned int AddM(unsigned int a, unsigned int b) {
	unsigned int c = a + b;
	return (c & 0x7FFFFFFF) + (c >> 31);
}

当c等于2^31-1时返回了c,而不是0。

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

No branches or pull requests

1 participant