https://gitlab.inria.fr/line/aide-group/macrovsa
Tip revision: 31a87d848f8ab28a06ccf77d0b359fc966974138 authored by vthierry on 15 December 2025, 21:31:50 UTC
sync from makefile
sync from makefile
Tip revision: 31a87d8
Number.cpp
#include "Number.hpp"
#include "Binding.hpp"
#include "algo.hpp"
#include <map>
namespace macrovsa {
const Symbol& Number::getInt(unsigned int value)
{
static const unsigned int MAX_REASONNABLE_COUNT = 10000;
static std::map < unsigned int, Symbol * > values;
aidesys::alert(values.size() >= MAX_REASONNABLE_COUNT, " illegal-argument", "in macrovsa::Number::getInt you are requesting too many values %d > %d for such symbolic implementation, memory overflow may occur", values.size(), MAX_REASONNABLE_COUNT);
{
auto it = values.find(value);
if(it == values.cend()) {
{
char chars[16];
sprintf(chars, "%d", value);
Symbol *symbol = new Symbol(chars);
values[value] = symbol;
return *symbol;
}
} else {
return *it->second;
}
}
}
}
