[llvm-commits] CVS: llvm/include/llvm/Instructions.h
Chris Lattner
clattner at apple.com
Sun Apr 22 14:29:33 PDT 2007
> + /// getAlignment - Return the alignment of the access that is
> being performed
> + ///
> + unsigned getAlignment() const {
> + signed Log2AlignVal = ((SubclassData>>1)-1);
> + return ((Log2AlignVal < 0) ? 0 : 1<<Log2AlignVal);
> + }
I think that this can be written as:
((1 << (SubclassData>>1)) >> 1
which is branchless and simpler.
> + /// getAlignment - Return the alignment of the access that is
> being performed
> + ///
> + unsigned getAlignment() const {
> + signed Log2AlignVal = ((SubclassData>>1)-1);
> + return ((Log2AlignVal < 0) ? 0 : 1<<Log2AlignVal);
> + }
Likewise,
-Chris
More information about the llvm-commits
mailing list