1 # $FreeBSD: head/bin/sh/tests/expansion/arith14.0 270029 2014-08-15 22:36:41Z jilles $
2 # Check that <</>> use the low bits of the shift count.
4 if [ $((1<<16<<16)) = 0 ]; then
6 elif [ $((1<<32<<32)) = 0 ]; then
8 elif [ $((1<<64<<64)) = 0 ]; then
10 elif [ $((1<<64>>64)) = 1 ]; then
11 # Integers are wider than 128 bits; assume arbitrary precision.
12 # Nothing to test here.
15 echo "Cannot determine integer width"
19 twowidth=$((width * 2))
20 j=43 k=$((1 << (width - 2))) r=0
23 while [ $i -lt $twowidth ]; do
24 if [ "$((j << i))" != "$((j << (i + width)))" ]; then
25 echo "Problem with $j << $i"
32 while [ $i -lt $twowidth ]; do
33 if [ "$((k >> i))" != "$((k >> (i + width)))" ]; then
34 echo "Problem with $k >> $i"