source: libcfa/src/common.cfa @ ecaedf35

Last change on this file since ecaedf35 was 0aa4beb, checked in by Thierry Delisle <tdelisle@…>, 3 years ago

Visibility of some of the stdlib

  • Property mode set to 100644
File size: 1.1 KB
Line 
1//                               -*- Mode: C -*-
2//
3// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
4//
5// The contents of this file are covered under the licence agreement in the
6// file "LICENCE" distributed with Cforall.
7//
8// common.c --
9//
10// Author           : Peter A. Buhr
11// Created On       : Thu Jul 12 08:02:29 2018
12// Last Modified By : Peter A. Buhr
13// Last Modified On : Thu Jul 12 08:38:47 2018
14// Update Count     : 3
15//
16
17#include "common.hfa"
18#include <stdlib.h>                                     // div_t, *div
19
20#pragma GCC visibility push(default)
21
22//---------------------------------------
23
24[ int, int ] div( int num, int denom ) { div_t qr = div( num, denom ); return [ qr.quot, qr.rem ]; }
25[ long int, long int ] div( long int num, long int denom ) { ldiv_t qr = ldiv( num, denom ); return [ qr.quot, qr.rem ]; }
26[ long long int, long long int ] div( long long int num, long long int denom ) { lldiv_t qr = lldiv( num, denom ); return [ qr.quot, qr.rem ]; }
27forall( T | { T ?/?( T, T ); T ?%?( T, T ); } )
28[ T, T ] div( T num, T denom ) { return [ num / denom, num % denom ]; }
29
30// Local Variables: //
31// mode: c //
32// tab-width: 4 //
33// End: //
Note: See TracBrowser for help on using the repository browser.