include/math-emu/op-2.h

Source file repositories/reference/linux-study-clean/include/math-emu/op-2.h

File Facts

System
Linux kernel
Corpus path
include/math-emu/op-2.h
Extension
.h
Size
20190 bytes
Lines
606
Domain
Repository Root And Misc
Bucket
include
Inferred role
Repository Root And Misc: implementation source
Status
source implementation candidate

Why This File Exists

Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.

Dependency Surface

Detected Declarations

Annotated Snippet

if (__builtin_constant_p(N) && (N) == 1) {		       \
			X##_f1 = X##_f1 + X##_f1 +			       \
				(((_FP_WS_TYPE) (X##_f0)) < 0);		       \
			X##_f0 += X##_f0;				       \
		} else {						       \
			X##_f1 = X##_f1 << (N) | X##_f0 >>		       \
						(_FP_W_TYPE_SIZE - (N));       \
			X##_f0 <<= (N);					       \
		}							       \
		0;							       \
	    })								       \
	  : ({								       \
	      X##_f1 = X##_f0 << ((N) - _FP_W_TYPE_SIZE);		       \
	      X##_f0 = 0;						       \
	  })))


#define _FP_FRAC_SRL_2(X, N) (						       \
	(void) (((N) < _FP_W_TYPE_SIZE)					       \
	  ? ({								       \
	      X##_f0 = X##_f0 >> (N) | X##_f1 << (_FP_W_TYPE_SIZE - (N));      \
	      X##_f1 >>= (N);						       \
	    })								       \
	  : ({								       \
	      X##_f0 = X##_f1 >> ((N) - _FP_W_TYPE_SIZE);		       \
	      X##_f1 = 0;						       \
	    })))


/* Right shift with sticky-lsb.  */
#define _FP_FRAC_SRS_2(X, N, sz) (					       \
	(void) (((N) < _FP_W_TYPE_SIZE)					       \
	  ? ({								       \
	      X##_f0 = (X##_f1 << (_FP_W_TYPE_SIZE - (N)) | X##_f0 >> (N)      \
			| (__builtin_constant_p(N) && (N) == 1		       \
			   ? X##_f0 & 1					       \
			   : (X##_f0 << (_FP_W_TYPE_SIZE - (N))) != 0));       \
		X##_f1 >>= (N);						       \
	    })								       \
	  : ({								       \
	      X##_f0 = (X##_f1 >> ((N) - _FP_W_TYPE_SIZE)		       \
			| ((((N) == _FP_W_TYPE_SIZE			       \
			     ? 0					       \
			     : (X##_f1 << (2*_FP_W_TYPE_SIZE - (N))))          \
			    | X##_f0) != 0));				       \
	      X##_f1 = 0;						       \
	    })))

#define _FP_FRAC_ADDI_2(X,I)	\
  __FP_FRAC_ADDI_2(X##_f1, X##_f0, I)

#define _FP_FRAC_ADD_2(R,X,Y)	\
  __FP_FRAC_ADD_2(R##_f1, R##_f0, X##_f1, X##_f0, Y##_f1, Y##_f0)

#define _FP_FRAC_SUB_2(R,X,Y)	\
  __FP_FRAC_SUB_2(R##_f1, R##_f0, X##_f1, X##_f0, Y##_f1, Y##_f0)

#define _FP_FRAC_DEC_2(X,Y)	\
  __FP_FRAC_DEC_2(X##_f1, X##_f0, Y##_f1, Y##_f0)

#define _FP_FRAC_CLZ_2(R,X)	\
  do {				\
    if (X##_f1)			\
      __FP_CLZ(R,X##_f1);	\
    else 			\
    {				\
      __FP_CLZ(R,X##_f0);	\
      R += _FP_W_TYPE_SIZE;	\
    }				\
  } while(0)

/* Predicates */
#define _FP_FRAC_NEGP_2(X)	((_FP_WS_TYPE)X##_f1 < 0)
#define _FP_FRAC_ZEROP_2(X)	((X##_f1 | X##_f0) == 0)
#define _FP_FRAC_OVERP_2(fs,X)	(_FP_FRAC_HIGH_##fs(X) & _FP_OVERFLOW_##fs)
#define _FP_FRAC_CLEAR_OVERP_2(fs,X)	(_FP_FRAC_HIGH_##fs(X) &= ~_FP_OVERFLOW_##fs)
#define _FP_FRAC_EQ_2(X, Y)	(X##_f1 == Y##_f1 && X##_f0 == Y##_f0)
#define _FP_FRAC_GT_2(X, Y)	\
  (X##_f1 > Y##_f1 || (X##_f1 == Y##_f1 && X##_f0 > Y##_f0))
#define _FP_FRAC_GE_2(X, Y)	\
  (X##_f1 > Y##_f1 || (X##_f1 == Y##_f1 && X##_f0 >= Y##_f0))

#define _FP_ZEROFRAC_2		0, 0
#define _FP_MINFRAC_2		0, 1
#define _FP_MAXFRAC_2		(~(_FP_WS_TYPE)0), (~(_FP_WS_TYPE)0)

/*
 * Internals 
 */

Annotation

Implementation Notes