Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8183db10 authored by Vincent Chen's avatar Vincent Chen Committed by Greentime Hu
Browse files

math-emu: Use statement expressions to fix Wshift-count-overflow warning



To avoid "shift count >= width of type" warning, using statement
expressions to implement the conditional controlling before constant shift

The modification in op-2.h is taken from the glibc
commit 'sysdeps/unix/sysv/lin ("fe0b1e854ad32")'.

Signed-off-by: default avatarVincent Chen <vincentc@andestech.com>
Acked-by: default avatarGreentime Hu <greentime@andestech.com>
Signed-off-by: default avatarGreentime Hu <greentime@andestech.com>
parent a188339c
Loading
Loading
Loading
Loading
+7 −10
Original line number Diff line number Diff line
@@ -567,16 +567,13 @@
 */

#define _FP_FRAC_ASSEMBLE_2(r, X, rsize)	\
  do {						\
    if (rsize <= _FP_W_TYPE_SIZE)		\
      r = X##_f0;				\
    else					\
      {						\
	r = X##_f1;				\
	r <<= _FP_W_TYPE_SIZE;			\
	r += X##_f0;				\
      }						\
  } while (0)
	(void) (((rsize) <= _FP_W_TYPE_SIZE)	\
		? ({ (r) = X##_f0; })		\
		: ({				\
		     (r) = X##_f1;		\
		     (r) <<= _FP_W_TYPE_SIZE;	\
		     (r) += X##_f0;		\
		    }))

#define _FP_FRAC_DISASSEMBLE_2(X, r, rsize)				\
  do {									\
+6 −5
Original line number Diff line number Diff line
@@ -795,11 +795,12 @@ do { \
	  ur_ = (unsigned rtype) -r;					\
	else								\
	  ur_ = (unsigned rtype) r;					\
	if (rsize <= _FP_W_TYPE_SIZE)					\
	  __FP_CLZ(X##_e, ur_);						\
	else								\
	(void) (((rsize) <= _FP_W_TYPE_SIZE)				\
		? ({ __FP_CLZ(X##_e, ur_); })				\
		: ({							\
		     __FP_CLZ_2(X##_e, (_FP_W_TYPE)(ur_ >> _FP_W_TYPE_SIZE),  \
							    (_FP_W_TYPE)ur_); \
		  }));							\
	if (rsize < _FP_W_TYPE_SIZE)					\
		X##_e -= (_FP_W_TYPE_SIZE - rsize);			\
	X##_e = rsize - X##_e - 1;					\