[OpenBIOS] [PATCH 10/10] Adding filll Forth primitive

Segher Boessenkool segher at kernel.crashing.org
Wed Aug 17 09:23:19 CEST 2011


> +static void filll(void)
> +{
> +    ucell value = POP();
> +	ucell count = POP();
> +	ucell *dest = (ucell *)cell2pointer(POP());
> +
> +	int i;
> +	for (i = 0; i <= count / 4; i++) {
> +	    dest[i] = value;
> +	}
> +}

Apple's code does:

int *dest ... ;
for (i = count; i > 0; i -= 4)
	*dest++ = value;

which is not the same thing for huge count, or for count a multiple
of four (like all callers I have seen use; you write a word too many).


Segher




More information about the OpenBIOS mailing list