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

Incompatibilities in compress.h #21

Open
oskarlh opened this issue Dec 7, 2024 · 0 comments
Open

Incompatibilities in compress.h #21

oskarlh opened this issue Dec 7, 2024 · 0 comments

Comments

@oskarlh
Copy link

oskarlh commented Dec 7, 2024

The reason compress_compatability_test() fails in some cases (like when compiling for ARM with Clang with -O2) appears to be that shifts in vector_compress (the VECTOR24/VECTOR32 cases) are sometimes made like x >> y where x is unsigned int and y is greater than std::numeric_limits<unsigned int>::digits, which means the behavior is undefined. So if

			i1 = float_istoobig (*p1)? ~0u : (bitget (*p1, 0, 23) | bitput (1, 23, 24)) >> (1 + max - bitget (*p1, 23, 31));
			i2 = float_istoobig (*p2)? ~0u : (bitget (*p2, 0, 23) | bitput (1, 23, 24)) >> (1 + max - bitget (*p2, 23, 31));
			i3 = float_istoobig (*p3)? ~0u : (bitget (*p3, 0, 23) | bitput (1, 23, 24)) >> (1 + max - bitget (*p3, 23, 31));

is replaced by

			i1 = float_istoobig (*p1)? ~0u : (bitget (*p1, 0, 23) | bitput (1, 23, 24)) >> ((1 + max - bitget (*p1, 23, 31)) % 32);
			i2 = float_istoobig (*p2)? ~0u : (bitget (*p2, 0, 23) | bitput (1, 23, 24)) >> ((1 + max - bitget (*p2, 23, 31)) % 32);
			i3 = float_istoobig (*p3)? ~0u : (bitget (*p3, 0, 23) | bitput (1, 23, 24)) >> ((1 + max - bitget (*p3, 23, 31)) % 32);

I don't think the compatibility test is needed

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