Added upstream from http://ftp.icm.edu.pl/pub/loglan/
[loglan.git] / sources / pass1 / ifun.f
1 C    Loglan82 Compiler&Interpreter
2 C     Copyright (C) 1981-1993 Institute of Informatics, University of Warsaw
3 C     Copyright (C)  1993, 1994 LITA, Pau
4 C     
5 C     This program is free software; you can redistribute it and/or modify
6 C     it under the terms of the GNU General Public License as published by
7 C     the Free Software Foundation; either version 2 of the License, or
8 C     (at your option) any later version.
9 C     
10 C     This program is distributed in the hope that it will be useful,
11 C     but WITHOUT ANY WARRANTY; without even the implied warranty of
12 C     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 C     GNU General Public License for more details. File: LICENSE.GNU
14 C  ===============================================================     
15
16         integer function ibset(i,j)
17         integer i, j
18         ibset= or(i,lshift(1,j))
19         return
20         end
21
22         integer function ibclr(i,j)
23         integer i,j
24         ibclr = xor(i,and(i,lshift(1,j)))
25         return
26         end
27
28         logical function btest(i,j)
29         integer i,j
30         btest = and(i,lshift(1,j)) .ne. 0
31         return
32         end
33
34         integer function iand(i,j)
35         integer i,j
36         iand = and(i,j)
37         return
38         end
39
40         integer function ior(i,j)
41         integer i,j
42         ior = or(i,j)
43         return
44         end
45
46         integer function ieor(i,j)
47         integer i,j
48         ieor = xor(i,j)
49         return
50         end
51
52         integer function ishft(i,j)
53         integer i,j
54         if (j .eq. 0) goto 11 
55         if (j .gt. 0) goto 10
56         i=and(i,X'7fffffff')
57         ishft = rshift(i,-j)
58         return
59  10     ishft = lshift(i,j)
60         return
61  11     ishft = i
62         return
63         end
64
65         character function int2char(i)
66         integer i
67         int2char=char(i)
68         return
69         end
70
71
72