OLD | NEW |
1 /* | 1 /* |
2 * The copyright in this software is being made available under the 2-clauses | 2 * The copyright in this software is being made available under the 2-clauses |
3 * BSD License, included below. This software may be subject to other third | 3 * BSD License, included below. This software may be subject to other third |
4 * party and contributor rights, including patent rights, and no such rights | 4 * party and contributor rights, including patent rights, and no such rights |
5 * are granted under this license. | 5 * are granted under this license. |
6 * | 6 * |
7 * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium | 7 * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium |
8 * Copyright (c) 2002-2014, Professor Benoit Macq | 8 * Copyright (c) 2002-2014, Professor Benoit Macq |
9 * Copyright (c) 2001-2003, David Janssens | 9 * Copyright (c) 2001-2003, David Janssens |
10 * Copyright (c) 2002-2003, Yannick Verschueren | 10 * Copyright (c) 2002-2003, Yannick Verschueren |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 return l; | 185 return l; |
186 } | 186 } |
187 | 187 |
188 /** | 188 /** |
189 Multiply two fixed-precision rational numbers. | 189 Multiply two fixed-precision rational numbers. |
190 @param a | 190 @param a |
191 @param b | 191 @param b |
192 @return Returns a * b | 192 @return Returns a * b |
193 */ | 193 */ |
194 static INLINE OPJ_INT32 opj_int_fix_mul(OPJ_INT32 a, OPJ_INT32 b) { | 194 static INLINE OPJ_INT32 opj_int_fix_mul(OPJ_INT32 a, OPJ_INT32 b) { |
195 #if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) && def
ined(_M_IX86) | 195 // TODO(thakis): Remove __clang__ once chromium's clang has clang r250301 |
| 196 #if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) && def
ined(_M_IX86) && !defined(__clang__) |
196 OPJ_INT64 temp = __emul(a, b); | 197 OPJ_INT64 temp = __emul(a, b); |
197 #else | 198 #else |
198 OPJ_INT64 temp = (OPJ_INT64) a * (OPJ_INT64) b ; | 199 OPJ_INT64 temp = (OPJ_INT64) a * (OPJ_INT64) b ; |
199 #endif | 200 #endif |
200 temp += 4096; | 201 temp += 4096; |
201 assert((temp >> 13) <= (OPJ_INT64)0x7FFFFFFF); | 202 assert((temp >> 13) <= (OPJ_INT64)0x7FFFFFFF); |
202 assert((temp >> 13) >= (-(OPJ_INT64)0x7FFFFFFF - (OPJ_INT64)1)); | 203 assert((temp >> 13) >= (-(OPJ_INT64)0x7FFFFFFF - (OPJ_INT64)1)); |
203 return (OPJ_INT32) (temp >> 13); | 204 return (OPJ_INT32) (temp >> 13); |
204 } | 205 } |
205 | 206 |
206 static INLINE OPJ_INT32 opj_int_fix_mul_t1(OPJ_INT32 a, OPJ_INT32 b) { | 207 static INLINE OPJ_INT32 opj_int_fix_mul_t1(OPJ_INT32 a, OPJ_INT32 b) { |
207 #if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) && def
ined(_M_IX86) | 208 // TODO(thakis): Remove __clang__ once chromium's clang has clang r250301 |
| 209 #if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) && def
ined(_M_IX86) && !defined(__clang__) |
208 OPJ_INT64 temp = __emul(a, b); | 210 OPJ_INT64 temp = __emul(a, b); |
209 #else | 211 #else |
210 OPJ_INT64 temp = (OPJ_INT64) a * (OPJ_INT64) b ; | 212 OPJ_INT64 temp = (OPJ_INT64) a * (OPJ_INT64) b ; |
211 #endif | 213 #endif |
212 temp += 4096; | 214 temp += 4096; |
213 assert((temp >> (13 + 11 - T1_NMSEDEC_FRACBITS)) <= (OPJ_INT64)0x7FFFFFF
F); | 215 assert((temp >> (13 + 11 - T1_NMSEDEC_FRACBITS)) <= (OPJ_INT64)0x7FFFFFF
F); |
214 assert((temp >> (13 + 11 - T1_NMSEDEC_FRACBITS)) >= (-(OPJ_INT64)0x7FFFF
FFF - (OPJ_INT64)1)); | 216 assert((temp >> (13 + 11 - T1_NMSEDEC_FRACBITS)) >= (-(OPJ_INT64)0x7FFFF
FFF - (OPJ_INT64)1)); |
215 return (OPJ_INT32) (temp >> (13 + 11 - T1_NMSEDEC_FRACBITS)) ; | 217 return (OPJ_INT32) (temp >> (13 + 11 - T1_NMSEDEC_FRACBITS)) ; |
216 } | 218 } |
217 | 219 |
218 /* ----------------------------------------------------------------------- */ | 220 /* ----------------------------------------------------------------------- */ |
219 /*@}*/ | 221 /*@}*/ |
220 | 222 |
221 /*@}*/ | 223 /*@}*/ |
222 | 224 |
223 #endif | 225 #endif |
OLD | NEW |