source: src/libcfa/algorithm.c@ d3b7937

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors ctor deferred_resn demangler enum forall-pointer-decay gc_noraii jacob/cs343-translation jenkins-sandbox memory new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new string with_gc
Last change on this file since d3b7937 was d3b7937, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

building runtime library (first attempt)

  • Property mode set to 100644
File size: 1.4 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// algorithm.c --
8//
9// Author : Peter A. Buhr
10// Created On : Thu Jan 28 17:10:29 2016
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Fri Jan 29 15:49:59 2016
13// Update Count : 29
14//
15
16#include "algorithm"
17
18forall( type T | { int ?<?( T, T ); } )
19T min( const T t1, const T t2 ) {
20 return t1 < t2 ? t1 : t2;
21} // min
22
23forall( type T | { int ?>?( T, T ); } )
24T max( const T t1, const T t2 ) {
25 return t1 > t2 ? t1 : t2;
26} // max
27
28
29extern "C" {
30#include <stdlib.h> // abs, labs, llabs
31#include <math.h> // fabsf, fabs, fabsl
32#include <complex.h> // cabsf, cabs, cabsl
33} // extern
34
35char abs( char v ) { return abs( (int)v ); }
36long int abs( long int v ) { return labs( v ); }
37long long int abs( long long int v ) { return llabs( v ); }
38float abs( float v ) { return fabsf( v ); }
39double abs( double v ) { return fabs( v ); }
40long double abs( long double v ) { return fabsl( v ); }
41float _Complex abs( float _Complex v ) { return cabsf( v ); }
42double _Complex abs( double _Complex v ) { return cabs( v ); }
43long double _Complex abs( long double _Complex v ) { return cabsl( v ); }
44
45
46// Local Variables: //
47// tab-width: 4 //
48// End: //
Note: See TracBrowser for help on using the repository browser.