Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: third_party/lcov-1.9/example/methods/gauss.c

Issue 23189008: Upgrades lcov to 1.10, removes lcov-1.9 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-adds UNKNOWN suppression Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/lcov-1.9/example/iterate.h ('k') | third_party/lcov-1.9/example/methods/iterate.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/lcov-1.9/example/methods/gauss.c
diff --git a/third_party/lcov-1.9/example/methods/gauss.c b/third_party/lcov-1.9/example/methods/gauss.c
deleted file mode 100644
index 9da3ce50835b1f32141b1d4ba321abd053ac0aac..0000000000000000000000000000000000000000
--- a/third_party/lcov-1.9/example/methods/gauss.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * methods/gauss.c
- *
- * Calculate the sum of a given range of integer numbers.
- *
- * Somewhat of a more subtle way of calculation - and it even has a story
- * behind it:
- *
- * Supposedly during math classes in elementary school, the teacher of
- * young mathematician Gauss gave the class an assignment to calculate the
- * sum of all natural numbers between 1 and 100, hoping that this task would
- * keep the kids occupied for some time. The story goes that Gauss had the
- * result ready after only a few minutes. What he had written on his black
- * board was something like this:
- *
- * 1 + 100 = 101
- * 2 + 99 = 101
- * 3 + 98 = 101
- * .
- * .
- * 100 + 1 = 101
- *
- * s = (1/2) * 100 * 101 = 5050
- *
- * A more general form of this formula would be
- *
- * s = (1/2) * (max + min) * (max - min + 1)
- *
- * which is used in the piece of code below to implement the requested
- * function in constant time, i.e. without dependencies on the size of the
- * input parameters.
- *
- */
-
-#include "gauss.h"
-
-
-int gauss_get_sum (int min, int max)
-{
- /* This algorithm doesn't work well with invalid range specifications
- so we're intercepting them here. */
- if (max < min)
- {
- return 0;
- }
-
- return (int) ((max + min) * (double) (max - min + 1) / 2);
-}
« no previous file with comments | « third_party/lcov-1.9/example/iterate.h ('k') | third_party/lcov-1.9/example/methods/iterate.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698