20 return value ?
"Yes" :
"No";
36 float a = round(value / precision);
37 return fixNegativeZero(a * precision);
41 while (
param[0] ==
' ') {
44 int len = std::strlen(
param);
45 while (len > 0 &&
param[len - 1] ==
' ') {
53 constexpr int bufferLength = 10;
57 size_t idx = bufferLength - 1;
63 auto digit = num % radix;
74 }
while ((num /= radix) != 0);
79 while (idx < bufferLength)
136 unsigned long hash = 5381;
139 while ( (c = *str++) ) {
141 hash = ((hash << 5) + hash) + c;
151#if EFI_HISTOGRAMS && ! EFI_UNIT_TEST
153 int len =
hsReport(histogram, report);
156 logging.append(PROTOCOL_MSG LOG_DELIMITER);
158 for (
int i = 0; i < len; i++)
161 logging.append(LOG_DELIMITER);
170float limitRateOfChange(
float newValue,
float oldValue,
float incrLimitPerSec,
float decrLimitPerSec,
float secsPassed) {
171 if (newValue >= oldValue)
172 return (incrLimitPerSec <= 0.0f) ? newValue : oldValue + std::min(newValue - oldValue, incrLimitPerSec * secsPassed);
173 return (decrLimitPerSec <= 0.0f) ? newValue : oldValue - std::min(oldValue - newValue, decrLimitPerSec * secsPassed);
177 bool afterCurrent =
test >= current;
178 bool beforeNext =
test < next;
180 if (next > current) {
184 return afterCurrent && beforeNext;
191 return afterCurrent || beforeNext;
195static uint32_t
getBitRangeCommon(
const uint8_t data[],
int bitIndex,
int bitWidth,
int secondByteOffset) {
196 int byteIndex = bitIndex >> 3;
197 int shift = bitIndex - byteIndex * 8;
199 uint32_t dataShift = 0;
200 int remainWidth = shift + bitWidth;
201 while (remainWidth > 0) {
202 value += data[byteIndex] << dataShift;
203 byteIndex += secondByteOffset;
207 uint32_t mask = (uint64_t(1) << bitWidth) - 1;
208 return (value >> shift) & mask;
221void setBitRangeLsb(uint8_t data[],
const int totalBitIndex,
const int bitWidth,
const uint32_t value) {
222 int leftBitWidth = bitWidth;
223 const int byteIndex = totalBitIndex >> 3;
224 const int bitInByteIndex = totalBitIndex - byteIndex * 8;
225 if (bitInByteIndex + bitWidth > 8) {
226 const int bitsToHandleNow = 8 - bitInByteIndex;
227 setBitRangeLsb(data, totalBitIndex + bitsToHandleNow, leftBitWidth - bitsToHandleNow, value >> bitsToHandleNow);
228 leftBitWidth = bitsToHandleNow;
230 uint32_t mask = (uint64_t(1) << leftBitWidth) - 1;
231 data[byteIndex] = data[byteIndex] & (~(mask << bitInByteIndex));
232 const uint32_t maskedValue = value & mask;
233 const uint32_t shiftedValue = maskedValue << bitInByteIndex;
234 data[byteIndex] = data[byteIndex] | shiftedValue;
237void setBitRangeMsb(uint8_t data[],
const int totalBitIndex,
const int bitWidth,
const uint32_t value) {
238 int leftBitWidh = bitWidth;
239 const int byteIndex = totalBitIndex >> 3;
240 const int bitInByteIndex = totalBitIndex - byteIndex * 8;
241 if (bitInByteIndex + leftBitWidh > 8) {
242 const int bitsToHandleNow = 8 - bitInByteIndex;
243 setBitRangeMsb(data, (byteIndex - 1) * 8, leftBitWidh - bitsToHandleNow, value >> bitsToHandleNow);
244 leftBitWidh = bitsToHandleNow;
246 const uint32_t mask = (uint64_t(1) << leftBitWidh) - 1;
247 data[byteIndex] = data[byteIndex] & (~(mask << bitInByteIndex));
248 const uint32_t maskedValue = value & mask;
249 const uint32_t shiftedValue = maskedValue << bitInByteIndex;
250 data[byteIndex] = data[byteIndex] | shiftedValue;
256 b = b - (b % 8) + 7 - (b % 8);
260 b = b - (b % 8) + 7 - (b % 8);
269void setBitRangeMoto(uint8_t data[],
const int totalBitIndex,
const int bitWidth,
const uint32_t value) {
void appendPrintf(const char *fmt,...) __attribute__((format(printf
Buffered console output stream header.
float limitRateOfChange(float newValue, float oldValue, float incrLimitPerSec, float decrLimitPerSec, float secsPassed)
int djb2lowerCase(const char *str)
uint32_t getBitRangeMoto(const uint8_t data[], int bitIndex, int bitWidth)
int motorolaMagicFromDbc(int b, int length)
const char * boolToString(bool value)
void setBitRangeLsb(uint8_t data[], const int totalBitIndex, const int bitWidth, const uint32_t value)
void setBitRangeMsb(uint8_t data[], const int totalBitIndex, const int bitWidth, const uint32_t value)
bool isPhaseInRange(float test, float current, float next)
float efiRound(float value, float precision)
void printHistogram(Logging *logging, histogram_s *histogram)
This function knows how to print a histogram_s summary.
static char * ltoa_internal(char *p, uint32_t num, unsigned radix)
static char * itoa_signed(char *p, int num, unsigned radix)
static uint32_t getBitRangeCommon(const uint8_t data[], int bitIndex, int bitWidth, int secondByteOffset)
uint32_t getBitRangeLsb(const uint8_t data[], int bitIndex, int bitWidth)
char * efiTrim(char *param)
char * itoa10(char *p, int num)
uint32_t getBitRangeMsb(const uint8_t data[], int bitIndex, int bitWidth)
void setBitRangeMoto(uint8_t data[], const int totalBitIndex, const int bitWidth, const uint32_t value)
int hsReport(histogram_s *h, int *report)
Prepare histogram report.
This data structure is used to analyze CPU performance.
UNUSED(samplingTimeSeconds)
void scheduleLogging(Logging *logging)
static BigBufferHandle buffer
static tstrWifiInitParam param