[liba] Update the size_t type definition

size_t must be an unsigned it. Moreover, by definition, size_t is the
return type of the "sizeof" operator, which is defined by the compiler.
Both GCC and clang define a __SIZE_TYPE__ macro to let the libc header
know about the type used by the sizeof operator.

Change-Id: Ie44f1ba69fe2b1d5ce5cd9a0e7fd8a7f10c1199d
This commit is contained in:
Romain Goyet
2016-09-21 14:03:52 +02:00
parent d6c52ac3d0
commit e24d8a55fb
2 changed files with 2 additions and 2 deletions

View File

@@ -2,6 +2,6 @@
#define LIBA_STDDEF_H
#define NULL 0
typedef int size_t;
typedef __SIZE_TYPE__ size_t;
#endif

View File

@@ -46,7 +46,7 @@ Expression * CommutativeOperation::clone() const {
float CommutativeOperation::approximate(Context& context) const {
float result = m_operands[0]->approximate(context);
for (size_t i=1; i<m_numberOfOperands; i++) {
for (int i=1; i<m_numberOfOperands; i++) {
float next = m_operands[i]->approximate(context);
result = this->operateApproximatevelyOn(result, next);
}