Skip to content

Commit

Permalink
Update bits-info.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
ale5000-git authored Oct 21, 2024
1 parent f1a5c8c commit 0936742
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions tools/bits-info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,6 @@
SCRIPT_NAME='Bits info'
SCRIPT_VERSION='1.5.4'

echo '==='
result=0
if false; then
result=1
elif true && false; then
result=2
else
result=3
fi
echo "Result: ${result}"
echo '==='

### CONFIGURATION ###

set -u 2> /dev/null || :
Expand Down Expand Up @@ -193,8 +181,14 @@ hex_bytes_to_int()
# $4 Bytes to compare (hex)
compare_hex_bytes()
{
test "${3}" -gt 0 || return 1
#test "$(printf '%s' "${1}" | cut -b "$((${2} * 2 + 1))-$(((${2} + ${3}) * 2))" || :)" = "${4}"
test "${3}" -gt 0 || return 2
test "$(printf '%s' "${1}" | cut -b "$((${2} * 2 + 1))-$(((${2} + ${3}) * 2))" || :)" = "${4}"
}
compare_hex_bytes2()
{
test "${3}" -gt 0 || return 2
set -- "${1}" "$((${2} * 2 + 1))" "$(((${2} + ${3}) * 2))" "${4}" || return 3
test "$(printf '%s' "${1}" | cut -b "${2}-${3}" || :)" = "${4}"
}

# Params:
Expand Down Expand Up @@ -896,7 +890,6 @@ main()
shell_bit="$(retrieve_bitness_from_uname || :)" # Use it only as last resort (almost never happens)
fi

set -x
os_bit='unknown'
if test "${OS-}" = 'Windows_NT' && os_bit="${PROCESSOR_ARCHITEW6432:-${PROCESSOR_ARCHITECTURE-}}" && test -n "${os_bit}"; then
# On Windows 2000+ / ReactOS
Expand All @@ -915,10 +908,8 @@ set -x
*) os_bit='unknown' ;;
esac
else
echo '---'
os_bit="$(retrieve_bitness_from_uname || :)" # Use it only as last resort (almost never happens)
fi
set +x

if test -r '/proc/cpuinfo' && tmp_var="$(grep -e '^flags[[:space:]]*:' -- '/proc/cpuinfo' | cut -d ':' -f '2-' -s)" && test -n "${tmp_var}"; then
if printf '%s\n' "${tmp_var}" | grep -m 1 -q -w -e '[[:lower:]]\{1,\}_lm'; then
Expand Down

0 comments on commit 0936742

Please sign in to comment.