示例#1
0
epicsShareFunc int
epicsParseUInt16(const char *str, epicsUInt16 *to, int base, char **units)
{
    unsigned long value;
    int status = epicsParseULong(str, &value, base, units);

    if (status)
        return status;

    if (value > 0xffff && value <= ~0xffffUL)
        return S_stdlib_overflow;

    *to = (epicsUInt16) value;
    return 0;
}
示例#2
0
int
epicsParseUInt32(const char *str, epicsUInt32 *to, int base, char **units)
{
    unsigned long value;
    int status = epicsParseULong(str, &value, base, units);

    if (status)
        return status;

#if (ULONG_MAX > 0xffffffffULL)
    if (value > 0xffffffffUL && value <= ~0xffffffffUL)
        return S_stdlib_overflow;
#endif

    *to = (epicsUInt32) value;
    return 0;
}
示例#3
0
epicsShareFunc int
epicsParseUInt64(const char *str, epicsUInt64 *to, int base, char **units)
{
#if (ULONG_MAX == 0xffffffffffffffffULL)
    unsigned long value;
    int status = epicsParseULong(str, &value, base, units);
#else
    unsigned long long value;
    int status = epicsParseULLong(str, &value, base, units);
#endif

    if (status)
        return status;

    *to = value;
    return 0;
}