Long Branches

Amos Shapir amos at instable.UUCP
Tue Jan 20 17:00:06 AEST 1987


A portable kludge solution to the problem: the VAX BSD compiler
generates 'casel' instructions only for switches in which the value range
is dense, i.e. there are a lot of used values between the highest and lowest
case values (I think the criterion is (hi-lo)/nused>=1/3 ).
Otherwise, it generates a set of if's, creating in effect a binary search tree.
If you add a dummy case with a value that is way out of the range, if's
should be created instead of a casel.
After that, if the branches are still too long, just do 'sed s/brw/jmp/'
on the assembly file.
-- 
	Amos Shapir
National Semiconductor (Israel)
6 Maskit st. P.O.B. 3007, Herzlia 46104, Israel
(011-972) 52-522261  amos%nsta at nsc 34.48'E 32.10'N



More information about the Comp.lang.c mailing list