SR_API int sr_analog_to_float(const struct sr_datafeed_analog *analog,
float *outbuf)
{
- float offset;
unsigned int b, i, count;
gboolean bigendian;
if (analog->encoding->scale.p != 1
|| analog->encoding->scale.q != 1)
outbuf[i] = (outbuf[i] * analog->encoding->scale.p) / analog->encoding->scale.q;
- offset = ((float)analog->encoding->offset.p / (float)analog->encoding->offset.q);
+ float offset = ((float)analog->encoding->offset.p / (float)analog->encoding->offset.q);
outbuf[i] += offset;
}
}
SR_API const char *sr_analog_si_prefix(float *value, int *digits)
{
/** @cond PRIVATE */
-#define NEG_PREFIX_COUNT 5 /* number of prefixes below unity */
+#define NEG_PREFIX_COUNT 5 /* number of prefixes below unity */
#define POS_PREFIX_COUNT (int)(ARRAY_SIZE(prefixes) - NEG_PREFIX_COUNT - 1)
/** @endcond */
static const char *prefixes[] = { "f", "p", "n", "ยต", "m", "", "k", "M", "G", "T" };
return SR_ERR_ARG;
}
- res->p = (int64_t)(p);
- res->q = (uint64_t)(q);
+ res->p = (int64_t)p;
+ res->q = (uint64_t)q;
return SR_OK;