Last change
on this file since 114 was
114,
checked in by smasson, 18 years ago
|
new compilation options (compile_opt idl2, strictarrsubs) in each routine
|
-
Property svn:executable set to
*
|
File size:
337 bytes
|
Line | |
---|
1 | FUNCTION bit2int, bitin, checkneg = checkneg |
---|
2 | ; |
---|
3 | compile_opt idl2, strictarrsubs |
---|
4 | ; |
---|
5 | |
---|
6 | res = 0L |
---|
7 | n = n_elements(bitin)-1 |
---|
8 | IF keyword_set(checkneg) THEN BEGIN |
---|
9 | IF bitin[0] EQ 1 THEN BEGIN |
---|
10 | bitin[0] = 0 |
---|
11 | neg = -1 |
---|
12 | ENDIF ELSE neg = 1 |
---|
13 | ENDIF ELSE neg = 1 |
---|
14 | FOR i = 0, n DO res = res+2L^i*bitin[n-i] |
---|
15 | |
---|
16 | RETURN, neg*res |
---|
17 | END |
---|
Note: See
TracBrowser
for help on using the repository browser.