Last change
on this file since 288 was
262,
checked in by pinsard, 17 years ago
|
corrections of some headers and parameters and keywords case. change of pro2href to replace proidl
|
-
Property svn:keywords set to
Id
|
File size:
539 bytes
|
Line | |
---|
1 | ;+ |
---|
2 | ; @file_comments |
---|
3 | ; |
---|
4 | ; |
---|
5 | ; @categories |
---|
6 | ; |
---|
7 | ; |
---|
8 | ; @param BITIN |
---|
9 | ; |
---|
10 | ; |
---|
11 | ; @keyword CHECKNEG |
---|
12 | ; |
---|
13 | ; |
---|
14 | ; @returns |
---|
15 | ; |
---|
16 | ; |
---|
17 | ; @uses |
---|
18 | ; |
---|
19 | ; |
---|
20 | ; @restrictions |
---|
21 | ; |
---|
22 | ; |
---|
23 | ; @examples |
---|
24 | ; |
---|
25 | ; |
---|
26 | ; @history |
---|
27 | ; |
---|
28 | ; |
---|
29 | ; @version |
---|
30 | ; $Id$ |
---|
31 | ; |
---|
32 | ; @todo |
---|
33 | ; seb |
---|
34 | ; |
---|
35 | ;- |
---|
36 | FUNCTION bit2int, bitin, CHECKNEG = checkneg |
---|
37 | ; |
---|
38 | compile_opt idl2, strictarrsubs |
---|
39 | ; |
---|
40 | |
---|
41 | res = 0L |
---|
42 | n = n_elements(bitin)-1 |
---|
43 | IF keyword_set(checkneg) THEN BEGIN |
---|
44 | IF bitin[0] EQ 1 THEN BEGIN |
---|
45 | bitin[0] = 0 |
---|
46 | neg = -1 |
---|
47 | ENDIF ELSE neg = 1 |
---|
48 | ENDIF ELSE neg = 1 |
---|
49 | FOR i = 0, n DO res = res+2L^i*bitin[n-i] |
---|
50 | |
---|
51 | RETURN, neg*res |
---|
52 | END |
---|
Note: See
TracBrowser
for help on using the repository browser.