Last change
on this file since 157 was
150,
checked in by navarro, 18 years ago
|
english and nicer header (3a)
|
-
Property svn:keywords set to
Id
|
File size:
361 bytes
|
Line | |
---|
1 | ;+ |
---|
2 | ; |
---|
3 | ; @todo |
---|
4 | ; seb |
---|
5 | ; |
---|
6 | ;- |
---|
7 | FUNCTION bit2int, bitin, checkneg = checkneg |
---|
8 | ; |
---|
9 | compile_opt idl2, strictarrsubs |
---|
10 | ; |
---|
11 | |
---|
12 | res = 0L |
---|
13 | n = n_elements(bitin)-1 |
---|
14 | IF keyword_set(checkneg) THEN BEGIN |
---|
15 | IF bitin[0] EQ 1 THEN BEGIN |
---|
16 | bitin[0] = 0 |
---|
17 | neg = -1 |
---|
18 | ENDIF ELSE neg = 1 |
---|
19 | ENDIF ELSE neg = 1 |
---|
20 | FOR i = 0, n DO res = res+2L^i*bitin[n-i] |
---|
21 | |
---|
22 | RETURN, neg*res |
---|
23 | END |
---|
Note: See
TracBrowser
for help on using the repository browser.