~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to dbug/factorial.c

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifdef DBUG_OFF                         /* We are testing dbug */
 
2
 
 
3
int factorial(register int value) {
 
4
        if(value > 1) {
 
5
                value *= factorial(value-1);
 
6
        }
 
7
        return value;
 
8
}
 
9
 
 
10
#else
 
11
 
 
12
#include <my_global.h>
 
13
 
 
14
int factorial (
 
15
register int value)
 
16
{
 
17
    DBUG_ENTER ("factorial");
 
18
    DBUG_PRINT ("find", ("find %d factorial", value));
 
19
    if (value > 1) {
 
20
        value *= factorial (value - 1);
 
21
    }
 
22
    DBUG_PRINT ("result", ("result is %d", value));
 
23
    DBUG_RETURN (value);
 
24
}
 
25
 
 
26
#endif
 
27