Mercurial > projects > doodle
comparison 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 |
comparison
equal
deleted
inserted
replaced
27:f3d91579bb28 | 28:1754cb773d41 |
---|---|
1 module tk.misc; | |
2 | |
3 double min(in double a, in double b) { | |
4 return a < b ? a : b; | |
5 } | |
6 | |
7 double max(in double a, in double b) { | |
8 return a > b ? a : b; | |
9 } | |
10 | |
11 double clamp(in double v, in double min, in double max) { | |
12 assert(min < max); | |
13 | |
14 if (v < min) { return min; } | |
15 else if (v > max) { return max; } | |
16 else { return v; } | |
17 } |