Skip to content

APInt API is atrocious #5579

@lattner

Description

@lattner
Bugzilla Link 5207
Resolution FIXED
Resolved on Dec 09, 2010 02:35
Version 1.0
OS All
CC @asl,@jayfoad

Extended Description

The APInt API is extremely inconsistent. Among other things, some methods update the APInt in place, and some return a new APInt. This leads to awful stuff like:

V = V.lshr(ByteStart*8);
V.trunc(ByteSize*8);

I think that we should fix this by changing operations that update in place to have an _eq suffix, this would give us:

V = V.lshr_eq(ByteStart*8);
V = V.trunc_eq(ByteSize*8);

or, better yet in this case:

V.lshr(ByteStart*8);
V.trunc(ByteSize*8);

The ones that update in place should return void to make it really clear that they do not return a new APInt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions