blob: 4d407aaf1c3213438ac0fbf3dd6d758ca49a6da5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
############################################################################
#
# File: intstr.icn
#
# Subject: Procedure to create string from bits
#
# Author: Robert J. Alexander
#
# Date: April 2, 1990
#
############################################################################
#
# This file is in the public domain.
#
############################################################################
#
# intstr() -- Creates a string consisting of the raw bits in the low
# order "size" bytes of integer i.
#
# This procedure is normally used for processing of binary data
# to be written to a file.
#
# Note that if large integers are supported, this procedure still
# will not work for integers larger than the implementation defined
# word size due to the shifting in of zero-bits from the left in the
# right shift operation.
#
procedure intstr(i,size)
local s
s := ""
every 1 to size do {
s := char(iand(i,16rFF)) || s
i := ishift(i,-8)
}
return s
end
|