Module Name: othersrc Committed By: agc Date: Thu Sep 1 05:08:06 UTC 2011
Added Files: othersrc/external/historical/eawk/dist: bit1.sh Log Message: add a small file forgotten in previous To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 othersrc/external/historical/eawk/dist/bit1.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Added files: Index: othersrc/external/historical/eawk/dist/bit1.sh diff -u /dev/null othersrc/external/historical/eawk/dist/bit1.sh:1.1 --- /dev/null Thu Sep 1 05:08:06 2011 +++ othersrc/external/historical/eawk/dist/bit1.sh Thu Sep 1 05:08:06 2011 @@ -0,0 +1,28 @@ +#! /bin/sh + +# executable in $1 + +case $# in +1) exe=$1 ;; +*) exe=eawk ;; +esac + +${exe} ' +BEGIN { + x = 255 + comp = compl(x) + printf("x %#x, compl %x\n", x, comp) + y = lshift(x, 2) + printf("x %#x, y %#x\n", x, y) + z = rshift(y, 2) + printf("x %#x, y %#x, z %#x\n", x, y, z) + a = 98 + b = xor(a, 255) + printf("a %#x, b %#x\n", a, b) + c = 65537 + printf("c & b = %x & %x = %x\n", c, b, and(c, b)) + printf("c | b = %x | %x = %x\n", c, b, or(c, b)) + c = 3579 + printf("c & b = %x & %x = %x\n", c, b, and(c, b)) + printf("c | b = %x | %x = %x\n", c, b, or(c, b)) +}' /dev/null