Commit Graph

19 Commits

Author SHA1 Message Date
David Neto
ba73a7cee5 Fix conversion warnings reported by GCC. 2016-01-06 17:36:33 -05:00
David Neto
f80b51fa9b Fix var shadowing and width mismatches in hex_float.h 2016-01-06 13:11:42 -05:00
David Neto
d0de196439 operator<< on FloatProxy preserves float and fill
Fixes formatting of disassembler output after printing
a hex float, e.g. for a NaN or subnormal.
2016-01-05 12:49:55 -05:00
Umar Arshad
b9ad418c95 Fix warnings with Apple clang++
* Unused private member
* Overflow error when subtracting num_fraction_bits for HF16 and HF
2015-12-10 13:15:06 -05:00
Andrew Woloszyn
4e5bc928c0 Added Float16, and HexFloat conversions 2015-12-08 14:41:57 -05:00
Ben Vanik
01c8d7a8fb Merge pull request #23.
Fixing some C++ conversion errors.
* Implicit conversion from int to bool.
* Implicit conversion from size_t to uint32_t.
* Implicit conversion from char* to uint8_t.

Adding no-op color operators so unhandled platforms can still link.
2015-11-23 01:42:46 -05:00
Lei Zhang
8bd75d650e Clean up CMake configuration and address compiler warnings.
- Removed dead configuration in CMakeLists.txt.
- Used target_compile_options() instead of CMAKE_{C|CXX}_FLAGS.
- Turned on warnings on tests.
- Fixed various warnings for comparing signed with unsigned values.
- Removed dead code exposed by compiler warnings.
2015-11-18 16:32:41 -05:00
Lei Zhang
af9906e4e5 Use Google comment style and fix typos. 2015-11-16 17:25:43 -05:00
David Neto
229b90f6f4 Print OpConstant values according to type.
Zero and normal floating point values are printed with enough
enough digits to reproduce all the bits exactly.
Other float values (subnormal, infinity, and NaN) are printed
as hex floats.

Fix a binary parse bug: Count partially filled words in a
typed literal number operand.

TODO: Assembler support for hex numbers, and therefore reading
infinities and NaNs.
2015-11-10 15:57:59 -05:00
Andrew Woloszyn
b3ae4b9422 Updated comment in SetBits.
It now mentions that it will fail if you try to set a bit that
does not exist.
2015-11-10 15:57:07 -05:00
Andrew Woloszyn
758b347983 Added double tests to HexFloat 2015-11-10 15:57:00 -05:00
Lei Zhang
1a0334edee Run clang-format to enforce Google style globally.
Note that we are more strict than Google style for one aspect:
pointer/reference indicators are adjacent to their types, not
their variables.

find . -name "*.h" -exec clang-format -i {} \;
find . -name "*.cpp" -exec clang-format -i {} \;
2015-11-10 15:56:47 -05:00
Andrew Woloszyn
6dfd4186f5 Updated HexFloat parsing for windows.
It is valid for float values to be modified on copy if they are NaN,
so long as they remain the correct NaN. What this means is that
we can not rely on the float data-type for storing float values
if we want to retain bit patterns.

Added FloatProxy which stores data in an unsigned integer, and updated
the HexFloat template to deal with FloatProxy values instead.
2015-11-02 13:52:31 -05:00
Andrew Woloszyn
0b61c593a2 Added HexFloat reading to HexFloat.
This allows reading of hex-encoded floats.
2015-11-02 13:52:28 -05:00
Andrew Woloszyn
c2887f98bc Added HexFloat helper class to print out floating point numbers.
TODO Add double tests before we actually use this.
2015-11-02 13:52:25 -05:00
Andrew Woloszyn
b78d2d31c5 Changed SetBits to index from LSB and take a size. 2015-11-02 13:52:23 -05:00
David Neto
9f79d789ec Inclusion guards follow Google C++ style
Follow the scheme in
http://google-styleguide.googlecode.com/svn/trunk/cppguide.html#The__define_Guard
except:
 - 'include/' is dropped from the guard token
 - 'source/' is dropped from the guard token
2015-11-02 13:52:15 -05:00
Andrew Woloszyn
f731cbf6c4 Added set_bits<> to bitutils.
This allows us to get a constant with the given bits set at
compile-time. This is needed for a future patch for HexFloat.
2015-11-02 13:51:51 -05:00
Lei Zhang
6483bd7132 Enforce suitable literal number operands to be unsigned integers.
Except for OpConstant and OpSpecConstant, all other literal number
operands are indeed unsigned integers. So,

* Rename all *LITERAL_NUMBER* operand types to *LITERAL_INTEGER*.
* Expect unsigned integers for *LITERAL_INTEGER* operands.
* Keep MULITPLE_WORD_LITERAL untouched since it is only used by
  OpConstant and OpSpecConstant.

And we want to provide the capability to specify floating-point
numbers after !<integer> in the alternate parsing mode. So,
OPTIONAL_LITERAL_NUMBER is reserved for OPTIONAL_CIV.
2015-10-26 12:55:33 -04:00