Mercurial > mm7
comparison mm7_2.cpp @ 295:640a176c030f
sub_42ECB5
author | Nomad |
---|---|
date | Tue, 19 Feb 2013 13:29:02 +0200 |
parents | 1f0af5cac2dd |
children | af7e848d6def |
comparison
equal
deleted
inserted
replaced
275:250e49fef6f6 | 295:640a176c030f |
---|---|
9122 while ( v6 ); | 9122 while ( v6 ); |
9123 } | 9123 } |
9124 } | 9124 } |
9125 | 9125 |
9126 //----- (00452A9E) -------------------------------------------------------- | 9126 //----- (00452A9E) -------------------------------------------------------- |
9127 int sub_452A9E(int square_distance) | 9127 int integer_sqrt(int val) |
9128 { | 9128 { |
9129 signed int result; // eax@2 | 9129 signed int result; // eax@2 |
9130 int v2; // edx@3 | 9130 unsigned int v2; // edx@3 |
9131 unsigned int v3; // edi@3 | 9131 unsigned int v3; // edi@3 |
9132 //signed int v4; // ebx@3 | 9132 //signed int v4; // ebx@3 |
9133 int v5; // esi@4 | 9133 int v5; // esi@4 |
9134 | 9134 |
9135 if (square_distance < 1) | 9135 if (val < 1) |
9136 return square_distance; | 9136 return val; |
9137 | 9137 |
9138 | 9138 |
9139 v2 = 0; | 9139 v2 = 0; |
9140 v3 = square_distance; | 9140 v3 = val; |
9141 result = 0; | 9141 result = 0; |
9142 //v4 = 16; | 9142 //v4 = 16; |
9143 for (uint i = 0; i < 16; ++i) | 9143 for (uint i = 0; i < 16; ++i) |
9144 { | 9144 { |
9145 result *= 2; | 9145 result *= 2; |
9146 v2 = (v3 >> 30) | 4 * v2; | 9146 v2 = (v3 >> 30) | 4 * v2; |
9147 v5 = 2 * result + 1; | 9147 v5 = 2 * result + 1; |
9148 v3 *= 4; | 9148 v3 *= 4; |
9149 if ( v2 >= (unsigned int)v5 ) | 9149 if ( v2 >= v5 ) |
9150 { | 9150 { |
9151 ++result; | 9151 ++result; |
9152 v2 -= v5; | 9152 v2 -= v5; |
9153 } | 9153 } |
9154 //--v4; | 9154 //--v4; |
9155 } | 9155 } |
9156 //while ( v4 ); | 9156 //while ( v4 ); |
9157 if ( square_distance - result * result >= (unsigned int)(result - 1) ) | 9157 if ( val - result * result >= (unsigned int)(result - 1) ) |
9158 ++result; | 9158 ++result; |
9159 return result; | |
9159 } | 9160 } |
9160 | 9161 |
9161 //----- (00452AE2) -------------------------------------------------------- | 9162 //----- (00452AE2) -------------------------------------------------------- |
9162 int __fastcall MakeColorMaskFromBitDepth(int a1) | 9163 int __fastcall MakeColorMaskFromBitDepth(int a1) |
9163 { | 9164 { |