diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-04-08 05:23:38 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-04-08 05:24:52 +0300 |
commit | 808ea6271a0107cc3df52fb0ef18ccec191f6f15 (patch) | |
tree | 6da8eb7f2bb0df099255d3020f67f47d80465480 /source/blender/blenloader/intern/versioning_legacy.c | |
parent | ccfb9a96c346eb8df95775b34ae5388fa5fcacb1 (diff) |
Cleanup: confusing if statements & alignment
Diffstat (limited to 'source/blender/blenloader/intern/versioning_legacy.c')
-rw-r--r-- | source/blender/blenloader/intern/versioning_legacy.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c index 5dae6fbc464..94ad348bfcf 100644 --- a/source/blender/blenloader/intern/versioning_legacy.c +++ b/source/blender/blenloader/intern/versioning_legacy.c @@ -795,22 +795,14 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main) nr = me->totface; tface = me->tface; while (nr--) { - cp = (char *)&tface->col[0]; - if (cp[1] > 126) cp[1] = 255; else cp[1] *= 2; - if (cp[2] > 126) cp[2] = 255; else cp[2] *= 2; - if (cp[3] > 126) cp[3] = 255; else cp[3] *= 2; - cp = (char *)&tface->col[1]; - if (cp[1] > 126) cp[1] = 255; else cp[1] *= 2; - if (cp[2] > 126) cp[2] = 255; else cp[2] *= 2; - if (cp[3] > 126) cp[3] = 255; else cp[3] *= 2; - cp = (char *)&tface->col[2]; - if (cp[1] > 126) cp[1] = 255; else cp[1] *= 2; - if (cp[2] > 126) cp[2] = 255; else cp[2] *= 2; - if (cp[3] > 126) cp[3] = 255; else cp[3] *= 2; - cp = (char *)&tface->col[3]; - if (cp[1] > 126) cp[1] = 255; else cp[1] *= 2; - if (cp[2] > 126) cp[2] = 255; else cp[2] *= 2; - if (cp[3] > 126) cp[3] = 255; else cp[3] *= 2; + int j; + for (j = 0; j < 4; j++) { + int k; + cp = ((char *)&tface->col[j]) + 1; + for (k = 0; k < 3; k++) { + cp[k] = (cp[k] > 126) ? 255 : cp[k] * 2; + } + } tface++; } |