]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2009-11-21 Robert Millan <rmh.grub@aybabtu.com>
authorRobert Millan <rmh@aybabtu.com>
Sat, 21 Nov 2009 20:59:48 +0000 (20:59 +0000)
committerRobert Millan <rmh@aybabtu.com>
Sat, 21 Nov 2009 20:59:48 +0000 (20:59 +0000)
        * maintainance/gentrigtables.py: Avoid duplicate hardcoding of
        integer constants.

ChangeLog.trig
maintainance/gentrigtables.py

index c3cd735943678b908559a11f0303f829d44d6969..725e67859b28cef8e0680963542fcec2cf1acc27 100644 (file)
@@ -1,3 +1,8 @@
+2009-11-21  Robert Millan  <rmh.grub@aybabtu.com>
+
+       * maintainance/gentrigtables.py: Avoid duplicate hardcoding of
+       integer constants.
+
 2009-11-14  Colin D Bennet <colin@gibibit.com>
 
        Trigonometry support.
index 7c069f833e5f2e5f1486422524fa944670323b74..81b7bd058df42fedd3ea6cfe2835443a3f12f4e5 100644 (file)
@@ -2,7 +2,7 @@
 # Script to generate trigonometric function tables.
 #
 #  GRUB  --  GRand Unified Bootloader
-#  Copyright (C) 2008  Free Software Foundation, Inc.
+#  Copyright (C) 2008, 2009  Free Software Foundation, Inc.
 #
 #  GRUB is free software: you can redistribute it and/or modify
 #  it under the terms of the GNU General Public License as published by
@@ -41,14 +41,16 @@ def writeTable(arr, name):
 def main():
     sintab = []
     costab = []
-    for i in range(256):
+    angle_max = 256
+    fraction_scale = 16384
+    for i in range(angle_max):
         # Convert to an angle in 1/256 of a circle.
-        x = i * 2 * pi / 256
-        sintab.append(int(round(sin(x) * 16384)))
-        costab.append(int(round(cos(x) * 16384)))
+        x = i * 2 * pi / angle_max
+        sintab.append(int(round(sin(x) * fraction_scale)))
+        costab.append(int(round(cos(x) * fraction_scale)))
 
-    write("#define TRIG_ANGLE_MAX 256\n")
-    write("#define TRIG_FRACTION_SCALE 16384\n")
+    write("#define TRIG_ANGLE_MAX " + str (angle_max) + "\n")
+    write("#define TRIG_FRACTION_SCALE " + str (fraction_scale) + "\n")
     writeTable(sintab, "sintab")
     writeTable(costab, "costab")