[TUHS] Introduction

Jose R. Valverde jrvalverde at cnb.csic.es
Fri Jun 6 01:07:30 AEST 2008


> so i created the following C code out of it:
> 
> u.u_count = (-u.u_segmts[NUSEGS-1].sg_limit+0x100)<<8;
> ...
> 
> done by having 256² - 256*x. This was great. With that information I wrote
> in C:
> 
> u.u_count = (256-u.u_segmts[NUSEGS-1].sg_limit)<<8;


What happens if you use instead

	u.u_count = (~(-u.u_segmts[NUSEGS-1].sg_limit))<<8;

That should mean the same, would avoid using a hard coded value and the
compiler may optimize it to the same assembly.

I hope you understand that any advice will probably be faulty as we can
not check the code generated by our suggestions as you do. As long as you
don't mind that, it's OK.

				j
-- 
	These opinions are mine and only mine. Hey man, I saw them first!

			    José R. Valverde

	De nada sirve la Inteligencia Artificial cuando falta la Natural



More information about the TUHS mailing list