annotate doodle/tk/misc.d @ 28:1754cb773d41
Part-way through getting to compile with configure/builder.
author |
Graham St Jack <graham.stjack@internode.on.net> |
date |
Sun, 02 Aug 2009 16:27:21 +0930 |
parents |
tk/misc.d@06c30d250c0a |
children |
960b408d3ac5 |
rev |
line source |
0
|
1 module tk.misc;
|
|
2
|
26
|
3 double min(in double a, in double b) {
|
0
|
4 return a < b ? a : b;
|
|
5 }
|
|
6
|
26
|
7 double max(in double a, in double b) {
|
0
|
8 return a > b ? a : b;
|
|
9 }
|
|
10
|
26
|
11 double clamp(in double v, in double min, in double max) {
|
0
|
12 assert(min < max);
|
|
13
|
|
14 if (v < min) { return min; }
|
|
15 else if (v > max) { return max; }
|
|
16 else { return v; }
|
|
17 }
|