[SLOF] [PATCH 4/4] fbuffer: Implement RFILL as an accelerated primitive

Segher Boessenkool segher at kernel.crashing.org
Sat Aug 1 06:18:41 AEST 2015


Hi Thomas, a few comments...

On Fri, Jul 31, 2015 at 03:00:08PM +0200, Thomas Huth wrote:
> +#define _RFILL(dst, size, pat, t)	\

Not new in your patch, but underscore-capital is a reserved name.

> +{ \
> +	t *d1 = (t *)dst; \
> +	register t tmp = 0; \
> +	int i = sizeof(t); \
> +	while (i > 0) { tmp <<= 8; tmp |= pat & 0xff; } \
> +	SET_CI; \
> +	while (size > 0) { \
> +		*d1++ = tmp; size -= sizeof(t); \
> +	} \
> +	CLR_CI; \
> +}

You write the first block on one line, and the second on separate lines --
pick one :-)

"register" is useless.  You might need "unsigned" there though, or is "t"
always unsigned already?

You shouldn't need that (t *) cast.

> +#define _FASTRFILL(dst, size, pat) \
> +	switch (((type_u)dst | size) & (sizeof(type_u)-1)) { \
> +		case 0:			_RFILL(dst, size, pat, type_u); break; \
> +		case sizeof(type_l):	_RFILL(dst, size, pat, type_l); break; \
> +		case sizeof(type_w):	_RFILL(dst, size, pat, type_w); break; \
> +		default:		_RFILL(dst, size, pat, type_c); break; \
> +	}

This doesn't handle case 6 as "w".

> +PRIM(RFILL)
> +	type_u pat = ((dp--)->u);
> +	type_u size = ((dp--)->u);
> +	type_u *dst = (type_u *)((dp--)->u);

type_u *dst = (dp--)->a;


Segher


More information about the SLOF mailing list