~ubuntu-branches/debian/sid/calligraplan/sid

« back to all changes in this revision

Viewing changes to src/plugins/schedulers/rcps/3rdparty/LibRCPS/src/lib.h

  • Committer: Package Import Robot
  • Author(s): Pino Toscano
  • Date: 2018-02-01 18:20:19 UTC
  • Revision ID: package-import@ubuntu.com-20180201182019-1qo7qaim5wejm5k9
Tags: upstream-3.1.0
ImportĀ upstreamĀ versionĀ 3.1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef LIB_H
 
2
#define LIB_H
 
3
 
 
4
#include <stdlib.h>
 
5
 
 
6
/* return the bigger of the two arguments */
 
7
static /*inline*/ int kpt_max(const int a, const int b) {
 
8
        return a > b ? a : b;
 
9
}
 
10
 
 
11
/* return the smaller of the two arguments */
 
12
static /*inline*/ int kpt_min(const int a, const int b) {
 
13
        return a < b ? a : b;
 
14
}
 
15
 
 
16
/* return a random number between 0 and max (both inclusive)*/
 
17
static /*inline*/ int irand(const int max) {
 
18
        return (int) (1.0*max*rand()/(RAND_MAX+1.0));
 
19
}
 
20
 
 
21
#endif /* LIB_H */