forked from pytorch/FBGEMM
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix undefined behavior (pytorch#2587)
Summary: Pull Request resolved: pytorch#2587 For a signed integer type it is undefined behavior in C++ to left-shift bits into the leftmost position where the result would become a negative number. Rewrite several `((long long)1) << X)` expressions to `1ULL << X` using unsigned long long to avoid this undefined behavior fixing UBSan complaints. This rewrites all instances of the pattern for consistency (even in places that wouldn't end up shifting into the highest bit position). Reviewed By: jspark1105 Differential Revision: D57281091 fbshipit-source-id: c1be27825103916749af540c3e420edb4fb1bcb2
- Loading branch information
1 parent
006833a
commit 7792908
Showing
5 changed files
with
41 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters