include/drm/drm_fixed.h

Source file repositories/reference/linux-study-clean/include/drm/drm_fixed.h

File Facts

System
Linux kernel
Corpus path
include/drm/drm_fixed.h
Extension
.h
Size
5680 bytes
Lines
259
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 (rem >= b_abs) {
				res_abs |= 1;
				rem -= b_abs;
			}
		} while (--i != 0);
	}

	/* round up LSB */
	{
		u64 summand = (rem << 1) >= b_abs;

		res_abs += summand;
	}

	res = (s64) res_abs;
	if (a_neg ^ b_neg)
		res = -res;
	return res;
}

static inline s64 drm_fixp_exp(s64 x)
{
	s64 tolerance = div64_s64(DRM_FIXED_ONE, 1000000);
	s64 sum = DRM_FIXED_ONE, term, y = x;
	u64 count = 1;

	if (x < 0)
		y = -1 * x;

	term = y;

	while (term >= tolerance) {
		sum = sum + term;
		count = count + 1;
		term = drm_fixp_mul(term, div64_s64(y, count));
	}

	if (x < 0)
		sum = drm_fixp_div(DRM_FIXED_ONE, sum);

	return sum;
}

static inline int fxp_q4_from_int(int val_int)
{
	return val_int << 4;
}

static inline int fxp_q4_to_int(int val_q4)
{
	return val_q4 >> 4;
}

static inline int fxp_q4_to_int_roundup(int val_q4)
{
	return (val_q4 + 0xf) >> 4;
}

static inline int fxp_q4_to_frac(int val_q4)
{
	return val_q4 & 0xf;
}

#define FXP_Q4_FMT		"%d.%04d"
#define FXP_Q4_ARGS(val_q4)	fxp_q4_to_int(val_q4), (fxp_q4_to_frac(val_q4) * 625)

#endif

Annotation

Implementation Notes