Changeset a7cd739 in OpenModelica
- Timestamp:
- 2023-03-27T17:19:14+02:00 (13 months ago)
- Branches:
- maintenance/v1.21, maintenance/v1.22, maintenance/v1.23, master
- Children:
- 92b6780
- Parents:
- 10cfde04
- git-author:
- Per Östlund <per.ostlund@…> (03/27/23 17:19:14)
- git-committer:
- GitHub <noreply@…> (03/27/23 17:19:14)
- Location:
- OMCompiler/SimulationRuntime/c
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
OMCompiler/SimulationRuntime/c/meta/meta_modelica_builtin.c
rb0b1473 ra7cd739 50 50 if (i>=0 && i<=9) /* Small integers are used so much it makes sense to cache them */ 51 51 return mmc_strings_len1['0'+i]; 52 s printf(buffer, "%ld", (long)i);52 snprintf(buffer, 22, "%" PRINT_MMC_SINT_T, i); 53 53 res = mmc_mk_scon(buffer); 54 54 MMC_CHECK_STRING(res); … … 81 81 modelica_integer nobox_stringInt(threadData_t *threadData,metamodelica_string s) 82 82 { 83 longres;83 modelica_integer res; 84 84 char *endptr,*str=MMC_STRINGDATA(s); 85 85 MMC_CHECK_STRING(s); 86 86 errno = 0; 87 #if defined(_WIN64) || defined(__MINGW64__) 88 res = strtoll(str,&endptr,10); 89 #else 87 90 res = strtol(str,&endptr,10); 91 #endif 88 92 if (errno != 0 || str == endptr) 89 93 MMC_THROW_INTERNAL(); 90 94 if (*endptr != '\0') 91 95 MMC_THROW_INTERNAL(); 92 if (res > INT_MAX || res <INT_MIN)96 if (res > MODELICA_INT_MAX || res < MODELICA_INT_MIN) 93 97 MMC_THROW_INTERNAL(); 94 98 return res; -
OMCompiler/SimulationRuntime/c/openmodelica_types.h
ra96d222 ra7cd739 49 49 typedef unsigned long mmc_uint_t; 50 50 typedef long mmc_sint_t; 51 #define MODELICA_INT_MIN LONG_MIN ;52 #define MODELICA_INT_MAX LONG_MAX ;51 #define MODELICA_INT_MIN LONG_MIN 52 #define MODELICA_INT_MAX LONG_MAX 53 53 54 54 #elif defined(_LLP64) || defined(_WIN64) || defined(__MINGW64__) /* windows 64bit */ … … 67 67 typedef unsigned long long mmc_uint_t; 68 68 typedef long long mmc_sint_t; 69 #define MODELICA_INT_MIN LONG_MIN ;70 #define MODELICA_INT_MAX LONG_MAX ;69 #define MODELICA_INT_MIN LONG_MIN 70 #define MODELICA_INT_MAX LONG_MAX 71 71 72 72 #else /* 32bit platforms */ … … 79 79 typedef unsigned int mmc_uint_t; 80 80 typedef int mmc_sint_t; 81 #define MODELICA_INT_MIN INT_MIN ;82 #define MODELICA_INT_MAX INT_MAX ;81 #define MODELICA_INT_MIN INT_MIN 82 #define MODELICA_INT_MAX INT_MAX 83 83 84 84 #endif
Note: See TracChangeset
for help on using the changeset viewer.