Page MenuHomeFreeBSD

D12361.id33052.diff
No OneTemporary

D12361.id33052.diff

Index: contrib/one-true-awk/run.c
===================================================================
--- contrib/one-true-awk/run.c
+++ contrib/one-true-awk/run.c
@@ -1476,7 +1476,7 @@
{
Cell *x, *y;
Awkfloat u;
- int t;
+ int t, i;
Awkfloat tmp;
char *p, *buf;
Node *nextarg;
@@ -1525,10 +1525,14 @@
u = 0;
break;
}
- y = execute(a[1]->nnext);
- u = ((int)getfval(x)) & ((int)getfval(y));
- tempfree(y);
- nextarg = nextarg->nnext;
+ i = ((int)getfval(x));
+ while (nextarg != 0) {
+ y = execute(nextarg);
+ i &= (int)getfval(y);
+ tempfree(y);
+ nextarg = nextarg->nnext;
+ }
+ u = i;
break;
case FFOR:
if (nextarg == 0) {
@@ -1536,10 +1540,14 @@
u = 0;
break;
}
- y = execute(a[1]->nnext);
- u = ((int)getfval(x)) | ((int)getfval(y));
- tempfree(y);
- nextarg = nextarg->nnext;
+ i = ((int)getfval(x));
+ while (nextarg != 0) {
+ y = execute(nextarg);
+ i |= (int)getfval(y);
+ tempfree(y);
+ nextarg = nextarg->nnext;
+ }
+ u = i;
break;
case FXOR:
if (nextarg == 0) {
@@ -1547,10 +1555,14 @@
u = 0;
break;
}
- y = execute(a[1]->nnext);
- u = ((int)getfval(x)) ^ ((int)getfval(y));
- tempfree(y);
- nextarg = nextarg->nnext;
+ i = ((int)getfval(x));
+ while (nextarg != 0) {
+ y = execute(nextarg);
+ i ^= (int)getfval(y);
+ tempfree(y);
+ nextarg = nextarg->nnext;
+ }
+ u = i;
break;
case FLSHIFT:
if (nextarg == 0) {
Index: usr.bin/awk/awk.1
===================================================================
--- usr.bin/awk/awk.1
+++ usr.bin/awk/awk.1
@@ -690,12 +690,15 @@
.Bl -tag -width "lshift(a, b)"
.It Fn compl x
Returns the bitwise complement of integer argument x.
-.It Fn and x y
-Performs a bitwise AND on integer arguments x and y.
-.It Fn or x y
-Performs a bitwise OR on integer arguments x and y.
-.It Fn xor x y
-Performs a bitwise Exclusive-OR on integer arguments x and y.
+.It Fn and v1 v2 ...
+Performs a bitwise AND on all arguments provided, as integers.
+There must be at least two values.
+.It Fn or v1 v2 ...
+Performs a bitwise OR on all arguments provided, as integers.
+There must be at least two values.
+.It Fn xor v1 v2 ...
+Performs a bitwise Exclusive-OR on all arguments provided, as integers.
+There must be at least two values.
.It Fn lshift x n
Returns integer argument x shifted by n bits to the left.
.It Fn rshift x n

File Metadata

Mime Type
text/plain
Expires
Wed, Jan 28, 11:15 AM (11 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28065467
Default Alt Text
D12361.id33052.diff (2 KB)

Event Timeline