Last change
on this file since 134 was
134,
checked in by navarro, 18 years ago
|
change *.pro file properties (del eof-style, del executable, set keywords Id
|
-
Property svn:keywords set to
Id
|
File size:
337 bytes
|
Rev | Line | |
---|
[67] | 1 | FUNCTION bit2int, bitin, checkneg = checkneg |
---|
[114] | 2 | ; |
---|
| 3 | compile_opt idl2, strictarrsubs |
---|
| 4 | ; |
---|
[67] | 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.