我需要使用 shell 脚本将有符号 int32 数字转换为无符号数字
例如 :
convert Input : -256
Expected output: 4294967040
Run Code Online (Sandbox Code Playgroud)
这可以帮助你;
\n\n#!/bin/bash\ninput=$1\nif [[ $input -lt "0" ]]; then\n output=$((4294967296+$input))\nelse\n output=$input\nfi\necho $output\n\n\n#signed int32;\n#\xe2\x80\x932,147,483,648 to 2,147,483,647\n#unsigned int32\n#0 to 4,294,967,295\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
4996 次 |
| 最近记录: |