changeset 2707:38a3054b22ff

improvement
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 06 Jul 2018 16:51:08 +0200
parents 0511feaf0ec2
children 83c991aeb611 fac458593ac8
files Core/Endianness.h UnitTestsSources/ImageTests.cpp
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Core/Endianness.h	Fri Jul 06 16:48:48 2018 +0200
+++ b/Core/Endianness.h	Fri Jul 06 16:51:08 2018 +0200
@@ -146,8 +146,8 @@
 static inline uint16_t __orthanc_bswap16(uint16_t a)
 {
   const uint8_t* p = reinterpret_cast<const uint8_t*>(&a);
-  return (static_cast<uint32_t>(p[0]) << 8 |
-          static_cast<uint32_t>(p[1]));
+  return (static_cast<uint16_t>(p[0]) << 8 |
+          static_cast<uint16_t>(p[1]));
 
   // WARNING: The implementation below makes LSB (Linux Standard
   // Base) segfault in release builds. Don't use it!!!
--- a/UnitTestsSources/ImageTests.cpp	Fri Jul 06 16:48:48 2018 +0200
+++ b/UnitTestsSources/ImageTests.cpp	Fri Jul 06 16:51:08 2018 +0200
@@ -394,7 +394,8 @@
     v = 0;
     for (unsigned int y = 0; y < height; y++)
     {
-      const uint16_t *p = reinterpret_cast<const uint16_t*>((const uint8_t*) r.GetConstBuffer() + y * r.GetPitch());
+      const uint16_t *p = reinterpret_cast<const uint16_t*>
+        ((const uint8_t*) r.GetConstBuffer() + y * r.GetPitch());
       ASSERT_EQ(p, r.GetConstRow(y));
       for (unsigned int x = 0; x < width; x++, p++, v++)
       {
@@ -417,7 +418,8 @@
     v = 0;
     for (unsigned int y = 0; y < height; y++)
     {
-      const uint16_t *p = reinterpret_cast<const uint16_t*>((const uint8_t*) r2.GetConstBuffer() + y * r2.GetPitch());
+      const uint16_t *p = reinterpret_cast<const uint16_t*>
+        ((const uint8_t*) r2.GetConstBuffer() + y * r2.GetPitch());
       ASSERT_EQ(p, r2.GetConstRow(y));
       for (unsigned int x = 0; x < width; x++, p++, v++)
       {