comparison libinterp/dldfcn/__magick_read__.cc @ 17455:b76b14e386b3

Replace ambiguous call to pow with bit shift * __magick_read__.cc (encode_uint_image<T>): Replace ambiguous call to pow with bit shift for computing integer powers of two.
author Mike Miller <mtmiller@ieee.org>
date Fri, 20 Sep 2013 18:43:43 -0400
parents 8508b8ae46a8
children b41860a0bc24
comparison
equal deleted inserted replaced
17454:36877a45bd1b 17455:b76b14e386b3
24 */ 24 */
25 25
26 #ifdef HAVE_CONFIG_H 26 #ifdef HAVE_CONFIG_H
27 #include <config.h> 27 #include <config.h>
28 #endif 28 #endif
29
30 #include <cmath>
31 29
32 #include "file-stat.h" 30 #include "file-stat.h"
33 #include "oct-env.h" 31 #include "oct-env.h"
34 #include "oct-time.h" 32 #include "oct-time.h"
35 33
1033 // of the actual depth of the image. GM will then convert the values but 1031 // of the actual depth of the image. GM will then convert the values but
1034 // while in memory, it always keeps the values as specified by QuantumDepth. 1032 // while in memory, it always keeps the values as specified by QuantumDepth.
1035 // From GM documentation: 1033 // From GM documentation:
1036 // Color arguments are must be scaled to fit the Quantum size according to 1034 // Color arguments are must be scaled to fit the Quantum size according to
1037 // the range of MaxRGB 1035 // the range of MaxRGB
1038 const double divisor = (pow (2, bitdepth) - 1) / MaxRGB; 1036 const double divisor = static_cast<double>((1 << bitdepth) - 1) / MaxRGB;
1039 1037
1040 const P *img_fvec = img.fortran_vec (); 1038 const P *img_fvec = img.fortran_vec ();
1041 const P *a_fvec = alpha.fortran_vec (); 1039 const P *a_fvec = alpha.fortran_vec ();
1042 switch (type) 1040 switch (type)
1043 { 1041 {