You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@orc.apache.org by GitBox <gi...@apache.org> on 2021/03/27 08:42:11 UTC
[GitHub] [orc] dirtysalt edited a comment on pull request #670: Update ORCv1.md: Fix documentation about bitset in bloom filter section
dirtysalt edited a comment on pull request #670:
URL: https://github.com/apache/orc/pull/670#issuecomment-808692529
@dongjoon-hyun Oh. I never know that Java bit shift `<<` is sort of like a circular bit shift. That's to say `1L << 129` equals `1L << (129 % 64)`. So that explains why `1L << position` works.
If I do that in C++, the compiler will give a warning, and the result is undefined.
```
/// c++ code
int main() {
unsigned long long x = 0;
x |= (1ULL << 129);
printf("%llu\n", x);
return 0;
}
/// shell execution
mac :: ~/Public » g++ test.cpp
test.cpp:14:16: warning: shift count >= width of type [-Wshift-count-overflow]
x |= (1ULL << 129);
^ ~~~
1 warning generated.
mac :: ~/Public » ./a.out
4526632784
mac :: ~/Public » ./a.out
4345032528
```
But I do suggest modifying documentation as `1L << (position % 64)` which is less confused to C++ guys.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org