diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2021-11-21 17:04:21 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2021-11-21 17:09:35 +0900 |
commit | e6ba08c3b21cdb14ee3a97b5d584759a4597b54b (patch) | |
tree | e8b4121323f2f448aeaa15bf3bddb465f36aea8b /debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/input/d/tst02.d | |
parent | f312c235ea5f9971066f3808997d20f89c25f33b (diff) | |
download | extra-dependencies-e6ba08c3b21cdb14ee3a97b5d584759a4597b54b.tar.gz extra-dependencies-e6ba08c3b21cdb14ee3a97b5d584759a4597b54b.zip |
uncrustify-trinity: updated based on upstream version 0.74.0
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/input/d/tst02.d')
-rw-r--r-- | debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/input/d/tst02.d | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/input/d/tst02.d b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/input/d/tst02.d new file mode 100644 index 00000000..0b428d60 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/input/d/tst02.d @@ -0,0 +1,30 @@ + package static ushort calcHeaderCrc(bool aStartupFrame, bool aSyncFrame, ushort aFrameId, ushort aPayloadWords) { + uint crcData = aPayloadWords; + + crcData |= (aFrameId << 7); + + if (aSyncFrame) { + crcData |= BIT_19; + } + + if (aStartupFrame) { + crcData |= BIT_18; + } + + ushort crc = 0x1a; + const ushort table[16] = [ + 0x0000, 0x0385, 0x070A, 0x048F, + 0x0591, 0x0614, 0x029B, 0x011E, + 0x00A7, 0x0322, 0x07AD, 0x0428, + 0x0536, 0x06B3, 0x023C, 0x01B9]; + + for (int i = 0; i < 5; ++i) { + if (i != 0) { + crcData <<= 4; + } + crc = ((crc << 4) & 0x7FF) ^ table[((crc >> 7) ^ (crcData >> 16)) & 0x0F]; + } + + return(crc); + } + |