bool AD5933_Class::setRange(byte rangeToSet) { return setRange(rangeToSet, getByte(0x80)); }
bool AD5933_Class::setPGA(byte pgaGain){ return setPGA(pgaGain, getByte(0x80)); }
Utf8Codec::result Utf8Codec::do_in(MBState& s, const char* fromBegin, const char* fromEnd, const char*& fromNext, Char* toBegin, Char* toEnd, Char*& toNext) const { Utf8Codec::result retstat = ok; fromNext = fromBegin; toNext = toBegin; // check for empty input if (fromEnd == fromBegin) return ok; // check for incomplete byte order mark: if (numBytes(s, fromBegin, fromEnd) < 3) { if (getByte(s, fromBegin, fromEnd, 0) == '\xef') { while (fromNext < fromEnd) s.value.mbytes[s.n++] = *fromNext++; return ok; } } else { // skip byte order mark if (getByte(s, fromBegin, fromEnd, 0) == '\xef' && getByte(s, fromBegin, fromEnd, 1) == '\xbb' && getByte(s, fromBegin, fromEnd, 2) == '\xbf') { if (s.n <= 3) { fromNext += 3 - s.n; s.n = 0; } else { std::memmove(s.value.mbytes, s.value.mbytes + 3, s.n - 3); s.n -= 3; } } } while (fromNext < fromEnd) { if (toNext >= toEnd) { retstat = partial; break; } if (s.n < sizeof(s.value.mbytes)) { s.value.mbytes[s.n++] = *fromNext++; } uint8_t* fnext = reinterpret_cast<uint8_t *>(&s.value.mbytes[0]); uint8_t* fend = fnext + s.n; const size_t extraBytesToRead = trailingBytesForUTF8[*fnext]; if (fnext + extraBytesToRead >= fend) { retstat = partial; break; } if( !isLegalUTF8( fnext, extraBytesToRead + 1 ) ) { retstat = error; break; } *toNext = Char(0); switch (extraBytesToRead) { case 5: *toNext = Char((toNext->value() + *fnext++) << 6); // We should never get this for legal UTF-8 case 4: *toNext = Char((toNext->value() + *fnext++) << 6); // We should never get this for legal UTF-8 case 3: *toNext = Char((toNext->value() + *fnext++) << 6); case 2: *toNext = Char((toNext->value() + *fnext++) << 6); case 1: *toNext = Char((toNext->value() + *fnext++) << 6); case 0: *toNext = Char((toNext->value() + *fnext++)); } *toNext = Char(toNext->value() - offsetsFromUTF8[extraBytesToRead]); // UTF-16 surrogate values are illegal in UTF-32, and anything // over Plane 17 (> 0x10FFFF) is illegal. if (*toNext > MaxLegalUtf32) { *toNext = ReplacementChar; } else if(*toNext >= SurHighStart && *toNext <= SurLowEnd) { *toNext = ReplacementChar; } s.n = 0; ++toNext; } return retstat; }