Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F143207230
D12361.id33052.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D12361.id33052.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D12361: Bring in bit operation functions, ala gawk.
Attached
Detach File
Event Timeline
Log In to Comment