Skip to content

Commit aae7098

Browse files
committed
[GR-28376] Optimize align_up() in signature.c
PullRequest: graal/19297
2 parents ce6e183 + 9205e7b commit aae7098

File tree

1 file changed

+2
-4
lines changed
  • truffle/src/com.oracle.truffle.nfi.native/src

1 file changed

+2
-4
lines changed

truffle/src/com.oracle.truffle.nfi.native/src/signature.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,8 @@ struct cif_data {
5656
};
5757

5858
static int align_up(int index, int alignment) {
59-
if (index % alignment != 0) {
60-
index += alignment - (index % alignment);
61-
}
62-
return index;
59+
int mask = alignment - 1;
60+
return (index + mask) & ~mask;
6361
}
6462

6563
__thread struct __TruffleEnvInternal *cachedTruffleEnv = NULL;

0 commit comments

Comments
 (0)