Re: [hatari-devel] Falcon upper and lower borders added

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

On torstai 23 helmikuu 2012, Laurent Sallafranque wrote:
> Le 22/02/2012 23:09, Laurent Sallafranque a écrit :
>> Le 22/02/2012 20:36, Eero Tamminen a écrit :
>>>     memset(hvram_line,
>>>     
>>>         HostScreen_getPaletteColor(0),
>>>         videl.upperBorderSize * srcpitch * sizeof(*hvram_line));
>>>     
>>>     hvram_line += videl.upperBorderSize * srcpitch;
>>
>> I like this one, but memset only fills with bytes, but I need Uint32
>> colors in 8 BBPs.

Sorry, I hadn't thought of that.

 
>> Is there something similar to memset that would allow to set longs
>> instead of bytes ?

wmemset() in C99 sets wchar_t items, but those are 32-bit only
with Glibc, whereas on Windows wchar_t is 16-bits.


> This seems to work, do you confirm ?
> 
>                  memset(hvram_line,
> (Uint32)HostScreen_getPaletteColor(0), videl.upperBorderSize *
> (scrpitch>>2) * sizeof(*hvram_line));

I don't think that's going to work correctly everywhere.

Better to have some static inlines like:
-----------------
static void VIDEL_memset_uint32(Uint32 *addr, Uint32 value, int count)
{
	while (count-- >= 0) {
		*addr++ = color;
	}
}
static void VIDEL_memset_uint16(Uint16 *addr, Uint16 value, int count)
{
	while (count-- >= 0) {
		*addr++ = color;
	}
}
static void VIDEL_memset_uint8(Uint8 *addr, Uint8 value, int count)
{
	memset(addr, value, count);
}
-----------------


	- Eero



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/