Mercurial > repos > tabletprog
changeset 340:7279e21dad68
Fix internal variable name generation for certain float values
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 05 Apr 2015 21:34:49 -0700 |
parents | 74cab9b5f2a4 |
children | 6871e72b6db2 |
files | cbackend.js |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/cbackend.js Sat Apr 04 12:34:43 2015 -0700 +++ b/cbackend.js Sun Apr 05 21:34:49 2015 -0700 @@ -165,7 +165,7 @@ floatlit.prototype.toC = function() { var floatType = this.bits == 32 ? 'float' : 'double'; - var str = floatType + '_' + (this.val < 0 ? 'neg_' + (0-this.val).toString() : this.val.toString()).replace('.', '_'); + var str = floatType + '_' + (this.val < 0 ? 'neg_' + (0-this.val).toString() : this.val.toString()).replace('.', '_').replace('-', 'neg'); if (!(str in declaredInts)) { toplevelcode += 'obj_float' + this.bits + ' ' + str + ' = {{&obj_float' + this.bits + '_meta, NULL}, ' + this.val.toString() + '};\n'; declaredInts[str] = true;