Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c2nim fails to remove "LL" suffixes on types #247

Open
omentic opened this issue Jul 29, 2022 · 0 comments
Open

c2nim fails to remove "LL" suffixes on types #247

omentic opened this issue Jul 29, 2022 · 0 comments

Comments

@omentic
Copy link

omentic commented Jul 29, 2022

c2nim correctly identifies the size of integers appended with LL or similar, but fails to remove those suffixes in the generated code.

Here is an example:

static inline double wl_fixed_to_double(wl_fixed_t f) {
	union {
		double d;
		int64_t i;
	} u;
	u.i = ((1023LL + 44LL) << 52) + (1LL << 51) + f;
	return u.d - (3LL << 43);
}
proc wl_fixed_to_double*(f: wl_fixed_t): cdouble {.inline.} =
  type
    INNER_C_UNION_wayland-util_616 {.bycopy, union.} = object
      d: cdouble
      i: int64_t

  var u: INNER_C_UNION_wayland-util_616
  u.i = ((1023LL'i64 + 44LL'i64) shl 52) + (1LL'i64 shl 51) + f
  return u.d - (3LL'i64 shl 43)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant