packaging: initial import
[profile/ivi/syslinux.git] / lzo / lzo1f_d.ash
1 /* lzo1f_d.ash -- assembler implementation of the LZO1F decompression algorithm
2
3    This file is part of the LZO real-time data compression library.
4
5    Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
6    Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
7    Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
8    Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
9    Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
10    Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
11    Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
12    Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
13    Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
14    Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
15    Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
16    Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
17    Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
18    All Rights Reserved.
19
20    The LZO library is free software; you can redistribute it and/or
21    modify it under the terms of the GNU General Public License as
22    published by the Free Software Foundation; either version 2 of
23    the License, or (at your option) any later version.
24
25    The LZO library is distributed in the hope that it will be useful,
26    but WITHOUT ANY WARRANTY; without even the implied warranty of
27    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28    GNU General Public License for more details.
29
30    You should have received a copy of the GNU General Public License
31    along with the LZO library; see the file COPYING.
32    If not, write to the Free Software Foundation, Inc.,
33    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
34
35    Markus F.X.J. Oberhumer
36    <markus@oberhumer.com>
37    http://www.oberhumer.com/opensource/lzo/
38  */
39
40
41 /***********************************************************************
42 //
43 ************************************************************************/
44
45         ALIGN3
46 .L0:
47         xorl    %eax,%eax
48         movb    (%esi),%al
49         incl    %esi
50         cmpb    $31,%al
51         ja      .LM2
52
53         orb     %al,%al
54         movl    %eax,%ecx
55         jnz     .L2
56 1:
57         LODSB
58         orb     %al,%al
59         jnz     2f
60         addl    N_255,%ecx
61         jmp     1b
62 2:
63         lea     31(%eax,%ecx),%ecx
64 .L2:
65         TEST_OP((%edi,%ecx),%ebx)
66         TEST_IP((%esi,%ecx),%ebx)
67         movb    %cl,%al
68         shrl    $2,%ecx
69         rep
70         movsl
71         andb    $3,%al
72         jz      1f
73         movl    (%esi),%ebx
74         addl    %eax,%esi
75         movl    %ebx,(%edi)
76         addl    %eax,%edi
77 1:
78         movb    (%esi),%al
79         incl    %esi
80 .LM1:
81         cmpb    $31,%al
82         jbe     .LM21
83
84 .LM2:
85         cmpb    $223,%al
86         ja      .LM3
87
88         movl    %eax,%ecx
89         shrl    $2,%eax
90         lea     -1(%edi),%edx
91         andb    $7,%al
92         shrl    $5,%ecx
93         movl    %eax,%ebx
94
95         movb    (%esi),%al
96         leal    (%ebx,%eax,8),%eax
97         incl    %esi
98 .LM5:
99         subl    %eax,%edx
100         addl    $2,%ecx
101         xchgl   %edx,%esi
102         TEST_LOOKBEHIND(%esi)
103         TEST_OP((%edi,%ecx),%ebx)
104         cmpl    $6,%ecx
105         jb      1f
106         cmpl    $4,%eax
107         jb      1f
108         movb    %cl,%al
109         shrl    $2,%ecx
110         rep
111         movsl
112         andb    $3,%al
113         movb    %al,%cl
114 1:
115         rep
116         movsb
117         movl    %edx,%esi
118 .LN1:
119         movb    -2(%esi),%cl
120         andl    $3,%ecx
121         jz      .L0
122         movl    (%esi),%eax
123         addl    %ecx,%esi
124         movl    %eax,(%edi)
125         addl    %ecx,%edi
126         xorl    %eax,%eax
127         movb    (%esi),%al
128         incl    %esi
129         jmp     .LM1
130 .LM21:
131         TEST_OP(3(%edi),%edx)
132         shrl    $2,%eax
133         leal    -0x801(%edi),%edx
134         movl    %eax,%ecx
135         movb    (%esi),%al
136         incl    %esi
137         leal    (%ecx,%eax,8),%eax
138         subl    %eax,%edx
139         TEST_LOOKBEHIND(%edx)
140         movl    (%edx),%eax
141         movl    %eax,(%edi)
142         addl    $3,%edi
143         jmp     .LN1
144 1:
145         LODSB
146         orb     %al,%al
147         jnz     2f
148         addl    N_255,%ecx
149         jmp     1b
150 2:
151         lea     31(%eax,%ecx),%ecx
152         jmp     .LM4
153
154         ALIGN3
155 .LM3:
156         andb    $31,%al
157         movl    %eax,%ecx
158         jz      1b
159 .LM4:
160         movl    %edi,%edx
161         movw    (%esi),%ax
162         addl    $2,%esi
163         shrl    $2,%eax
164         jnz     .LM5
165
166 .LEOF:
167 /****   xorl    %eax,%eax          eax=0 from above */
168
169         cmpl    $1,%ecx         /* ecx must be 1 */
170         setnz   %al
171
172
173 /*
174 vi:ts=4
175 */
176