Skip to content

Cast necessary after integer promotion sometimes omitted  #3

@rversteegen

Description

@rversteegen
typedef unsigned int jit_uint;
#define	jit_label_undefined	((size_t)~((jit_uint)0))

(which has value 4294967295 on both x86-linux and x86_64-linux)
is translated by fbfrog (latest git head) to

type jit_uint as ulong
#define jit_label_undefined cuint(not cast(jit_uint, 0))

which has value 4294967295 on x86-linux and 18446744073709551615 on x86_64-linux.

On the other hand

#define	jit_label_undefined	((size_t)~((unsigned int)0))

translates to

const jit_label_undefined = cuint(culng(not culng(0)))

which has the correct value, 4294967295, on x86 and x86_64.

The double casts are necessary to paper over the difference in integer promotion rules between FB and C (which promote to integer and int respectively).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No 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