Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | pj | 1 | .globl getbits |
2 | .type getbits,@function |
||
3 | getbits: |
||
4 | cmpl $0,4(%esp) |
||
5 | jne .L1 |
||
6 | xorl %eax,%eax |
||
7 | ret |
||
8 | |||
9 | .L1: |
||
10 | movl wordpointer,%ecx |
||
11 | movzbl (%ecx),%eax |
||
12 | shll $16,%eax |
||
13 | movb 1(%ecx),%ah |
||
14 | movb 2(%ecx),%al |
||
15 | movl bitindex,%ecx |
||
16 | shll $8,%eax |
||
17 | shll %cl,%eax |
||
18 | movl 4(%esp),%ecx |
||
19 | addl %ecx,bitindex |
||
20 | negl %ecx |
||
21 | addl $32,%ecx |
||
22 | shrl %cl,%eax |
||
23 | movl bitindex,%ecx |
||
24 | sarl $3,%ecx |
||
25 | addl %ecx,wordpointer |
||
26 | andl $7,bitindex |
||
27 | ret |
||
28 | |||
29 | |||
30 | |||
31 | .globl getbits_fast |
||
32 | .type getbits_fast,@function |
||
33 | getbits_fast: |
||
34 | movl wordpointer,%ecx |
||
35 | movzbl 1(%ecx),%eax |
||
36 | movb (%ecx),%ah |
||
37 | movl bitindex,%ecx |
||
38 | shlw %cl,%ax |
||
39 | movl 4(%esp),%ecx |
||
40 | addl %ecx,bitindex |
||
41 | negl %ecx |
||
42 | addl $16,%ecx |
||
43 | shrl %cl,%eax |
||
44 | movl bitindex,%ecx |
||
45 | sarl $3,%ecx |
||
46 | addl %ecx,wordpointer |
||
47 | andl $7,bitindex |
||
48 | ret |
||
49 | |||
50 | |||
51 | |||
52 | .globl get1bit |
||
53 | .type get1bit,@function |
||
54 | get1bit: |
||
55 | movl wordpointer,%ecx |
||
56 | movzbl (%ecx),%eax |
||
57 | movl bitindex,%ecx |
||
58 | incl %ecx |
||
59 | rolb %cl,%al |
||
60 | andb $1,%al |
||
61 | movl %ecx,bitindex |
||
62 | andl $7,bitindex |
||
63 | sarl $3,%ecx |
||
64 | addl %ecx,wordpointer |
||
65 | ret |
||
66 | |||
67 | |||
68 |