Re: Help with structs



On Aug 27, 10:22 pm, Seebs <usenet-nos...@xxxxxxxxx> wrote:
On 2010-08-28, Jack Trades <jacktradespub...@xxxxxxxxx> wrote:

On Aug 27, 12:27 am, Behind China Blue Eyes <chine.b...@xxxxxxxxx>
wrote:
You can also flatten the switches with something like switch
(100*obj_1->type + obj_2->type).
I'm not quite sure how this would work.  Why multiply by 100?

Imagine that type runs from 1 to 50.

100*type1 + type2 will then run from 101 to 5050, with each
pair unique.  And you can do things like:

        case (TYPE_FLONUM * 100) + TYPE_FIXNUM:
        case (TYPE_FIXNUM * 100) + TYPE_FLONUM:
                /* handle fix/float pair */
                break;

OK. That makes perfect sense now.

Thanks
Jack Trades
.