1 /* sub16.h -- simple delta filter
2 
3    This file is part of the UPX executable compressor.
4 
5    Copyright (C) 1996-2020 Markus Franz Xaver Johannes Oberhumer
6    Copyright (C) 1996-2020 Laszlo Molnar
7    All Rights Reserved.
8 
9    UPX and the UCL library are free software; you can redistribute them
10    and/or modify them under the terms of the GNU General Public License as
11    published by the Free Software Foundation; either version 2 of
12    the License, or (at your option) any later version.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program; see the file COPYING.
21    If not, write to the Free Software Foundation, Inc.,
22    59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 
24    Markus F.X.J. Oberhumer              Laszlo Molnar
25    <markus@oberhumer.com>               <ezerotven+github@gmail.com>
26  */
27 
28 
29 
30 /*************************************************************************
31 //
32 **************************************************************************/
33 
34 #include "sub.hh"
35 
36 #define SUB16(f, N)     SUB(f, N, unsigned short, get_le16, set_le16)
37 #define ADD16(f, N)     ADD(f, N, unsigned short, get_le16, set_le16)
38 #define SCAN16(f, N)    SCAN(f, N, unsigned short, get_le16, set_le16)
39 
40 
41 /*************************************************************************
42 //
43 **************************************************************************/
44 
45 // filter
f_sub16_1(Filter * f)46 static int f_sub16_1(Filter *f)
47 {
48     SUB16(f, 1)
49 }
50 
f_sub16_2(Filter * f)51 static int f_sub16_2(Filter *f)
52 {
53     SUB16(f, 2)
54 }
55 
f_sub16_3(Filter * f)56 static int f_sub16_3(Filter *f)
57 {
58     SUB16(f, 3)
59 }
60 
f_sub16_4(Filter * f)61 static int f_sub16_4(Filter *f)
62 {
63     SUB16(f, 4)
64 }
65 
66 
67 // unfilter
u_sub16_1(Filter * f)68 static int u_sub16_1(Filter *f)
69 {
70     ADD16(f, 1)
71 }
72 
u_sub16_2(Filter * f)73 static int u_sub16_2(Filter *f)
74 {
75     ADD16(f, 2)
76 }
77 
u_sub16_3(Filter * f)78 static int u_sub16_3(Filter *f)
79 {
80     ADD16(f, 3)
81 }
82 
u_sub16_4(Filter * f)83 static int u_sub16_4(Filter *f)
84 {
85     ADD16(f, 4)
86 }
87 
88 
89 // scan
s_sub16_1(Filter * f)90 static int s_sub16_1(Filter *f)
91 {
92     SCAN16(f, 1)
93 }
94 
s_sub16_2(Filter * f)95 static int s_sub16_2(Filter *f)
96 {
97     SCAN16(f, 2)
98 }
99 
s_sub16_3(Filter * f)100 static int s_sub16_3(Filter *f)
101 {
102     SCAN16(f, 3)
103 }
104 
s_sub16_4(Filter * f)105 static int s_sub16_4(Filter *f)
106 {
107     SCAN16(f, 4)
108 }
109 
110 
111 #undef SUB
112 #undef ADD
113 #undef SCAN
114 #undef SUB16
115 #undef ADD16
116 #undef SCAN16
117 
118 /* vim:set ts=4 sw=4 et: */
119