[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] XaAES sources for FreeMiNT 1.16.3



Paul Wratt wrote:
this is the kernel, so "standard" SpareMint Libs used to compile MiNT
code:
	if (screen.planes > 8)
	{
		MFDB scr, dst;
		struct rgb_1000 srgb, rgb;
		short pxy[8];
		union { unsigned short w[64]; unsigned long l[32];} b;

		(*v->api->wr_mode)(v, MD_REPLACE);
		(*v->api->l_type)(v, 1);
		(*v->api->l_ends)(v, 0, 0);
		(*v->api->l_width)(v, 1);

		vq_color(v->handle, 0, 1, (short *)&srgb);
// 		display("saved %04d, %04d, %04d", srgb.red, srgb.green, srgb.blue);
		rgb.red = 1000;
		rgb.green = 1000;
		rgb.blue = 0;
		vs_color(v->handle, 0, (short *)&rgb);
		(*v->api->line)(v, 0, 0, 0, 0, 0);
	
	
		scr.fd_addr = NULL;

		dst.fd_addr = &b;
		dst.fd_w = 1;
		dst.fd_h = 1;
		dst.fd_wdwidth = 1;
		dst.fd_stand = 1;
		dst.fd_nplanes = screen.planes;
		dst.fd_r1 = dst.fd_r2 = dst.fd_r3 = 0;

		pxy[0] = 0;
		pxy[1] = 0;
		pxy[2] = 0;
		pxy[3] = 0;
		pxy[4] = 0;
		pxy[5] = 0;
		pxy[6] = 0;
		pxy[7] = 0;
	
		vro_cpyfm(v->handle, S_ONLY, pxy, &scr, &dst);

		vs_color(v->handle, 0, (short *)&srgb);

		switch (screen.planes)
		{

Oh, I see 2 things that require attention in this code:

1) The union used for the "b" variable. It looks like the standard clean way to get rid of that damn "dereferencing type-punned pointer will break strict-aliasing rules" warning with GCC 4.x, as I told you yesterday. This is clean, but when introducing such syntax, a lot of care must be taken to avoid potential regressions.

2) Call to vro_cpyfm(). This function was buggy in older ARAnyM version due to an SDL bug.

I absolutely don't say there is something wrong in this code, but the facts I have indicated must be kept in memory while looking for strange behaviours. I recall you that CVS has an "history" feature to see what changed in any source file.

--
Vincent Rivière