source: libcfa/src/common.cfa @ dd698b4

ADTast-experimentalenumforall-pointer-decayjacob/cs343-translationpthread-emulationqualifiedEnum
Last change on this file since dd698b4 was fd54fef, checked in by Michael Brooks <mlbrooks@…>, 4 years ago

Converting the project to use the new syntax for otype, dtype and ttytpe.

Changed prelude (gen), libcfa and test suite to use it. Added a simple deprecation rule of the old syntax to the parser; we might wish to support both syntaxes "officially," like with an extra CLI switch, but this measure should serve as a simple reminder for our team to try the new syntax.

  • 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//---------------------------------------
21
22[ int, int ] div( int num, int denom ) { div_t qr = div( num, denom ); return [ qr.quot, qr.rem ]; }
23[ long int, long int ] div( long int num, long int denom ) { ldiv_t qr = ldiv( num, denom ); return [ qr.quot, qr.rem ]; }
24[ 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 ]; }
25forall( T | { T ?/?( T, T ); T ?%?( T, T ); } )
26[ T, T ] div( T num, T denom ) { return [ num / denom, num % denom ]; }
27
28// Local Variables: //
29// mode: c //
30// tab-width: 4 //
31// End: //
Note: See TracBrowser for help on using the repository browser.