tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] [ RFC] About packing two infos in a long v2


From: Milutin Jovanović
Subject: Re: [Tinycc-devel] [ RFC] About packing two infos in a long v2
Date: Wed, 7 Nov 2012 10:09:51 -0500


Hi Thomas,

It does look cleaner now. Can I ask you to add a comment near the declaration of got_offsets on how to use it, meaning the shifting required. User should know how to use a value without having to search for current usages.

Other then that, looks OK to me. BTW, I did not check correctness, just reviewed the style and logic.

Miki.



On 6 November 2012 11:27, Thomas Preud'homme <address@hidden> wrote:
Le mardi 6 novembre 2012 16:37:21, Thomas Preud'homme a écrit :
> Le mardi 6 novembre 2012 16:22:00, Milutin Jovanović a écrit :

> Sure, I agree I don't like it. It create a risk of forgetting it for the
> future. But accessors or bitfield doesn't change anything. Bitfield needs
> to shift the value to the left for each use and accessors need to be used
> for each case. Someone reading tcc.h will be tempted to use the field
> immediately. At least bitfield makes it more clear to the compiler what's
> going on but it will not catch a mistake such has reading the value
> directly from got_offset.

I went with bit fields in the end. I also modified put_got_offset so that a value
can be set twice. Although it's not needed now, put_got_offset could be used by
someone in this way later on and that would lead to subtle bugs.

> > Small stylistic issue is that I (personally) don't like '& -2' mask. I
> > think this obfuscates the intent, and the simple '& ~1' is more usual,
> > and it should not be any slower. -2 also assumes two's complement
> > implementations...

Hence gone :)

I'll appreciate another review if you have time. Thanks again.

Thomas


reply via email to

[Prev in Thread] Current Thread [Next in Thread]