Imported Upstream version 1.12.0
[platform/upstream/gtest.git] / googletest / samples / prime_tables.h
index 3a10352..7c0286e 100644 (file)
@@ -27,8 +27,6 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-
-
 // This provides interface PrimeTable that determines whether a number is a
 // prime and determines a next prime number. This interface is used
 // in Google Test samples demonstrating use of parameterized tests.
@@ -57,7 +55,7 @@ class OnTheFlyPrimeTable : public PrimeTable {
   bool IsPrime(int n) const override {
     if (n <= 1) return false;
 
-    for (int i = 2; i*i <= n; i++) {
+    for (int i = 2; i * i <= n; i++) {
       // n is divisible by an integer other than 1 and itself.
       if ((n % i) == 0) return false;
     }
@@ -104,13 +102,13 @@ class PreCalculatedPrimeTable : public PrimeTable {
 
     // Checks every candidate for prime number (we know that 2 is the only even
     // prime).
-    for (int i = 2; i*i <= max; i += i%2+1) {
+    for (int i = 2; i * i <= max; i += i % 2 + 1) {
       if (!is_prime_[i]) continue;
 
       // Marks all multiples of i (except i itself) as non-prime.
       // We are starting here from i-th multiplier, because all smaller
       // complex numbers were already marked.
-      for (int j = i*i; j <= max; j += i) {
+      for (int j = i * i; j <= max; j += i) {
         is_prime_[j] = false;
       }
     }