Skip to content

Commit

Permalink
MDCM sync (style)
Browse files Browse the repository at this point in the history
  • Loading branch information
issakomi committed May 15, 2024
1 parent cf2622f commit 0c26da0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions mdcm/Source/Common/mdcmUnpacker12Bits.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@
namespace mdcm
{

// http:https://groups.google.com/group/comp.lang.c/msg/572bc9b085c717f3
bool Unpacker12Bits::Unpack(char * out, const char * in, size_t n)
{
if (n % 3 != 0)
return false; // 3 bytes are actually 2 words
// http:https://groups.google.com/group/comp.lang.c/msg/572bc9b085c717f3
short * q = static_cast<short*>(static_cast<void*>(out));
const unsigned char * p = reinterpret_cast<const unsigned char*>(in);
const unsigned char * end = p + n;
while (p != end)
{
unsigned char b0 = *p++;
unsigned char b1 = *p++;
unsigned char b2 = *p++;
const unsigned char b0 = *p++;
const unsigned char b1 = *p++;
const unsigned char b2 = *p++;
*q++ = static_cast<short>(((b1 & 0xf) << 8) + b0);
*q++ = static_cast<short>((b1 >> 4) + (b2 << 4));
}
Expand All @@ -53,8 +53,8 @@ bool Unpacker12Bits::Pack(char * out, const char * in, size_t n)
const unsigned short * end = static_cast<const unsigned short*>(static_cast<const void*>(in + n));
while (p != end)
{
unsigned short b0 = *p++;
unsigned short b1 = *p++;
const unsigned short b0 = *p++;
const unsigned short b1 = *p++;
*q++ = static_cast<unsigned char>(b0 & 0xff);
*q++ = static_cast<unsigned char>((b0 >> 8) + ((b1 & 0xf) << 4));
*q++ = static_cast<unsigned char>(b1 >> 4);
Expand Down

0 comments on commit 0c26da0

Please sign in to comment.