summaryrefslogtreecommitdiffstats
path: root/libvncserver/tableinit24.c
diff options
context:
space:
mode:
Diffstat (limited to 'libvncserver/tableinit24.c')
-rw-r--r--libvncserver/tableinit24.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libvncserver/tableinit24.c b/libvncserver/tableinit24.c
index 39e9920..5c5823c 100644
--- a/libvncserver/tableinit24.c
+++ b/libvncserver/tableinit24.c
@@ -147,11 +147,12 @@ rfbInitOneRGBTable24 (uint8_t *table, int inMax, int outMax, int outShift,
for (i = 0; i < nEntries; i++) {
outValue = ((i * outMax + inMax / 2) / inMax) << outShift;
*(uint32_t *)&table[3*i] = outValue;
- if(!rfbEndianTest)
+ if(!rfbEndianTest) {
memmove(table+3*i,table+3*i+1,3);
- if (swap) {
- c = table[3*i]; table[3*i] = table[3*i+2];
- table[3*i+2] = c;
- }
+ }
+ if (swap) {
+ c = table[3*i]; table[3*i] = table[3*i+2];
+ table[3*i+2] = c;
+ }
}
}