General: Internal code generator overhaul

This commit is contained in:
Philippe Tillet
2016-04-02 18:19:33 -04:00
parent 6ac5e1f55b
commit 7f77fba4d4
131 changed files with 5854 additions and 5721 deletions

View File

@@ -26,7 +26,7 @@
#include <algorithm>
#include "isaac/array.h"
#include "isaac/value_scalar.h"
#include "isaac/exception/unknown_datatype.h"
#include "isaac/exception/api.h"
namespace isaac
{
@@ -195,6 +195,24 @@ INSTANTIATE_ALL(pow, std::pow)
#undef INSTANTIATE_ALL
#undef INSTANTIATE
value_scalar cast(value_scalar const & in, numeric_type dtype)
{
switch(dtype)
{
case CHAR_TYPE: return (char)(in);
case UCHAR_TYPE: return (unsigned char)(in);
case SHORT_TYPE: return (short)(in);
case USHORT_TYPE: return (unsigned short)(in);
case INT_TYPE: return (int)(in);
case UINT_TYPE: return (unsigned int)(in);
case LONG_TYPE: return (long)(in);
case ULONG_TYPE: return (unsigned long)(in);
case FLOAT_TYPE: return (float)(in);
case DOUBLE_TYPE: return (double)(in);
default: throw unknown_datatype(dtype); //unreachable
}
}
std::ostream & operator<<(std::ostream & os, value_scalar const & s)
{
switch(s.dtype())