Adrien Audouard
/
DigitCode
fonction.cpp@1:0f2ba28c2e70, 2015-04-14 (annotated)
- Committer:
- Ridaz
- Date:
- Tue Apr 14 08:42:37 2015 +0000
- Revision:
- 1:0f2ba28c2e70
- Parent:
- 0:163dfb02ed36
;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Ridaz | 0:163dfb02ed36 | 1 | #include "fonction.h" |
Ridaz | 0:163dfb02ed36 | 2 | int bitToInt(int i) |
Ridaz | 0:163dfb02ed36 | 3 | { |
Ridaz | 0:163dfb02ed36 | 4 | switch (i) { |
Ridaz | 0:163dfb02ed36 | 5 | case 1: |
Ridaz | 0:163dfb02ed36 | 6 | return 0; |
Ridaz | 0:163dfb02ed36 | 7 | // break; |
Ridaz | 0:163dfb02ed36 | 8 | case 2: |
Ridaz | 0:163dfb02ed36 | 9 | return 1; |
Ridaz | 0:163dfb02ed36 | 10 | // break; |
Ridaz | 0:163dfb02ed36 | 11 | case 4: |
Ridaz | 0:163dfb02ed36 | 12 | return 2; |
Ridaz | 0:163dfb02ed36 | 13 | // break; |
Ridaz | 0:163dfb02ed36 | 14 | case 8: |
Ridaz | 0:163dfb02ed36 | 15 | return 3; |
Ridaz | 0:163dfb02ed36 | 16 | // break; |
Ridaz | 0:163dfb02ed36 | 17 | case 16: |
Ridaz | 0:163dfb02ed36 | 18 | return 4; |
Ridaz | 0:163dfb02ed36 | 19 | // break; |
Ridaz | 0:163dfb02ed36 | 20 | case 32: |
Ridaz | 0:163dfb02ed36 | 21 | return 5; |
Ridaz | 0:163dfb02ed36 | 22 | // break; |
Ridaz | 0:163dfb02ed36 | 23 | case 64: |
Ridaz | 0:163dfb02ed36 | 24 | return 6; |
Ridaz | 0:163dfb02ed36 | 25 | // break; |
Ridaz | 0:163dfb02ed36 | 26 | case 128: |
Ridaz | 0:163dfb02ed36 | 27 | return 7; |
Ridaz | 0:163dfb02ed36 | 28 | // break; |
Ridaz | 0:163dfb02ed36 | 29 | case 256: |
Ridaz | 0:163dfb02ed36 | 30 | return 8; |
Ridaz | 0:163dfb02ed36 | 31 | // break; |
Ridaz | 0:163dfb02ed36 | 32 | case 512: |
Ridaz | 0:163dfb02ed36 | 33 | return 9; |
Ridaz | 0:163dfb02ed36 | 34 | // break; |
Ridaz | 0:163dfb02ed36 | 35 | case 1024: |
Ridaz | 0:163dfb02ed36 | 36 | return -1; |
Ridaz | 0:163dfb02ed36 | 37 | // break; |
Ridaz | 0:163dfb02ed36 | 38 | case 2048: |
Ridaz | 0:163dfb02ed36 | 39 | return -2; |
Ridaz | 0:163dfb02ed36 | 40 | // break; |
Ridaz | 0:163dfb02ed36 | 41 | default: |
Ridaz | 0:163dfb02ed36 | 42 | return -3; |
Ridaz | 0:163dfb02ed36 | 43 | } |
Ridaz | 0:163dfb02ed36 | 44 | } |