Skip to content

Make python-generated source files compatible with rustfmt #66889

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

Merged
merged 3 commits into from
Dec 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/etc/dec2flt_table.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,18 @@ def print_proper_powers():
print("pub const MIN_E: i16 = {};".format(MIN_E))
print("pub const MAX_E: i16 = {};".format(MAX_E))
print()
print("#[rustfmt::skip]")
typ = "([u64; {0}], [i16; {0}])".format(len(powers))
print("pub const POWERS: ", typ, " = ([", sep='')
print("pub const POWERS: ", typ, " = (", sep='')
print(" [")
for z in powers:
print(" 0x{:x},".format(z.sig))
print("], [")
print(" 0x{:x},".format(z.sig))
print(" ],")
print(" [")
for z in powers:
print(" {},".format(z.exp))
print("]);")
print(" {},".format(z.exp))
print(" ],")
print(");")


def print_short_powers(num_bits, significand_size):
Expand All @@ -127,6 +131,7 @@ def print_short_powers(num_bits, significand_size):
max_e = int(ceil(log(max_sig, 5)))
e_range = range(max_e)
typ = "[f{}; {}]".format(num_bits, len(e_range))
print("#[rustfmt::skip]")
print("pub const F", num_bits, "_SHORT_POWERS: ", typ, " = [", sep='')
for e in e_range:
print(" 1e{},".format(e))
Expand Down
Loading