Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9a5a5d1

Browse files
author
Vladimir Marangozov
committed
Checks whether right shift extends the sign bit.
Patch by Thomas Wouters <[email protected]> with small changes of mine (in main(), use return instead of exit). Closes patch #100832 (but I can't assign it to myself, nor close it -- sorry)
1 parent bd9848d commit 9a5a5d1

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

configure.in

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,19 @@ AC_MSG_RESULT($usable_wchar_t)
11361136
# check for endianness
11371137
AC_C_BIGENDIAN
11381138

1139+
# Check whether right shifting a negative integer extends the sign bit
1140+
# or fills with zeros (like the Cray J90, according to Tim Peters).
1141+
AC_MSG_CHECKING(whether right shift extends the sign bit)
1142+
AC_TRY_RUN([
1143+
int main()
1144+
{
1145+
return ((-1)>>3 == -1) ? 1 : 0;
1146+
}
1147+
],
1148+
[AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS)
1149+
AC_MSG_RESULT(yes)],
1150+
[AC_MSG_RESULT(no)])
1151+
11391152
# THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
11401153
# Add sys/socket.h to confdefs.h
11411154
cat >> confdefs.h <<\EOF

0 commit comments

Comments
 (0)