This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH column number support


On Thu, Dec 04, 2003 at 12:47:43PM -0800, Per Bothner wrote:
> However, my guess is the remaining bugs may be in cpplib
> itself, rather than the line-map.[ch], and in any case it's
> useful to get feedback on the API.

The API looks good.  Thanks.

> One implementation detail:  I still use shifts and masks to
> separate out the column number.  An alternative might be
> to use division ('/' and '%' instead).  E.g. instead of:
> 
>   (loc - map->start_location) >> map->column_bits
> 
> do
> 
>   (loc - map->start_location) / map->column_limit
> 
> where column_limit replaces (1 << column_bits).  Doing a division
> makes the code a bit cleaner, plus we aren't limited to powers of 2.

Given that replacing division with pre-calculated mult+shift
tables in ggc-page made a real difference on modern machines,
I wouldn't discount the cost.

Lets leave the shift for now.


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]