[busybox] Use unsigned longs for bitwise operations in awk, thanks benoar.
authorAndy Boyett <agb@openwrt.org>
Thu, 28 Aug 2008 16:40:53 +0000 (16:40 +0000)
committerAndy Boyett <agb@openwrt.org>
Thu, 28 Aug 2008 16:40:53 +0000 (16:40 +0000)
 - Resolves the ipcalc.sh bug on some arches, closes #3012, #3946
 - Submitted upstream as busybox bug #4774

SVN-Revision: 12427

package/busybox/patches/530-unsigned_bitwise_ops.patch [new file with mode: 0644]

diff --git a/package/busybox/patches/530-unsigned_bitwise_ops.patch b/package/busybox/patches/530-unsigned_bitwise_ops.patch
new file mode 100644 (file)
index 0000000..3226892
--- /dev/null
@@ -0,0 +1,36 @@
+--- a/editors/awk.c
++++ b/editors/awk.c
+@@ -2046,27 +2046,27 @@
+               break;
+       case B_an:
+-              setvar_i(res, (long)getvar_i(av[0]) & (long)getvar_i(av[1]));
++              setvar_i(res, (unsigned long)getvar_i(av[0]) & (unsigned long)getvar_i(av[1]));
+               break;
+       case B_co:
+-              setvar_i(res, ~(long)getvar_i(av[0]));
++              setvar_i(res, ~(unsigned long)getvar_i(av[0]));
+               break;
+       case B_ls:
+-              setvar_i(res, (long)getvar_i(av[0]) << (long)getvar_i(av[1]));
++              setvar_i(res, (unsigned long)getvar_i(av[0]) << (unsigned long)getvar_i(av[1]));
+               break;
+       case B_or:
+-              setvar_i(res, (long)getvar_i(av[0]) | (long)getvar_i(av[1]));
++              setvar_i(res, (unsigned long)getvar_i(av[0]) | (unsigned long)getvar_i(av[1]));
+               break;
+       case B_rs:
+-              setvar_i(res, (long)((unsigned long)getvar_i(av[0]) >> (unsigned long)getvar_i(av[1])));
++              setvar_i(res, (unsigned long)getvar_i(av[0]) >> (unsigned long)getvar_i(av[1]));
+               break;
+       case B_xo:
+-              setvar_i(res, (long)getvar_i(av[0]) ^ (long)getvar_i(av[1]));
++              setvar_i(res, (unsigned long)getvar_i(av[0]) ^ (unsigned long)getvar_i(av[1]));
+               break;
+       case B_lo: