Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -0,0 +1,6 @@
|
|||
hex(s)=my(a=10,b=11,c=12,d=13,e=14,f=15);subst(Pol(eval(Vec(s))),'x,16);
|
||||
n1=hex("200000");n2=hex("1fffff");
|
||||
v1=digits(n1,256)
|
||||
v2=digits(n2,256)
|
||||
subst(Pol(v1),'x,256)==n1
|
||||
subst(Pol(v2),'x,256)==n2
|
||||
|
|
@ -1,30 +1,26 @@
|
|||
/*REXX program to test displaying of octets. */
|
||||
/*REXX program to display (and also test/verify) some numbers as octets.*/
|
||||
nums = x2d(200000) x2d(1fffff) 2097172 2097151
|
||||
#=words(nums)
|
||||
say ' number hex octet original'
|
||||
say '═════════ ═════════ ═════════ ═════════'
|
||||
ok=1
|
||||
do j=1 for #; @.j=word(nums,j)
|
||||
onum.j=octet(@.j)
|
||||
orig.j=x2d(space(onum.j,0))
|
||||
|
||||
num1=x2d(200000) ; say 'number1='num1 ' [in hex='d2x(num1)"]"
|
||||
num2=x2d(1fffff) ; say 'number2='num2 ' [in hex='d2x(num2)"]"
|
||||
num3=2097172 ; say 'number3='num3 ' [in hex='d2x(num3)"]"
|
||||
num4=2097151 ; say 'number4='num4 ' [in hex='d2x(num4)"]"
|
||||
say
|
||||
onum1=octet(num1) ; say 'number1 octet='onum1
|
||||
onum2=octet(num2) ; say 'number2 octet='onum2
|
||||
onum3=octet(num3) ; say 'number3 octet='onum3
|
||||
onum4=octet(num4) ; say 'number4 octet='onum4
|
||||
say
|
||||
bnum1=x2d(space(onum1,0)) ; say 'number1='bnum1
|
||||
bnum2=x2d(space(onum2,0)) ; say 'number2='bnum2
|
||||
bnum3=x2d(space(onum3,0)) ; say 'number3='bnum3
|
||||
bnum4=x2d(space(onum4,0)) ; say 'number4='bnum4
|
||||
say
|
||||
if num1==bnum1 &,
|
||||
num2==bnum2 &,
|
||||
num3==bnum3 &,
|
||||
num4==bnum4 then say 'numbers are OK'
|
||||
else say 'trouble in River City'
|
||||
exit /*stick a fork in it, we're done.*/
|
||||
say show(@.j) show(d2x(@.j)) show(onum.j) show(orig.j)
|
||||
if @.j\==orig.j then ok=0
|
||||
end /*j*/
|
||||
say
|
||||
if ok then say 'All' # "numbers are OK." /*all numbers good*/
|
||||
else say 'Trouble right here in River City.' /*some number ¬good*/
|
||||
exit /*stick a fork in it, we're done.*/
|
||||
/*──────────────────────────────────OCTET subroutine────────────────────*/
|
||||
octet: procedure; parse arg a,_; x=d2x(a) /*convert A to hex octet.*/
|
||||
|
||||
do j=length(x) by -2 to 1 /*process little end first.*/
|
||||
_=substr(x,j-1,2,0) _ /*pad odd hexchars with an 0 on left*/
|
||||
end /*j*/
|
||||
octet: procedure; parse arg a,_ /*obtain A from the passed arg. */
|
||||
x=d2x(a) /*convert A to hexadecimal octet.*/
|
||||
do j=length(x) by -2 to 1 /*process the "little" end first.*/
|
||||
_=substr(x,j-1,2,0) _ /*pad odd hexcharacters with ··· */
|
||||
end /*j*/ /* ··· a zero on the left. */
|
||||
return _
|
||||
/*──────────────────────────────────SHOW subroutine─────────────────────*/
|
||||
show: return center(arg(1),9) /*justify via centering the text.*/
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[2097152, 2097151].each do |i|
|
||||
[0x200000, 0x1fffff].each do |i|
|
||||
# Encode i => BER
|
||||
ber = [i].pack("w")
|
||||
hex = ber.unpack("C*").collect {|c| "%02x" % c}.join(":")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue