Changeset a9f2c13 for src/libcfa


Ignore:
Timestamp:
Jun 30, 2016, 4:17:59 PM (8 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
e20f53c
Parents:
1bc1bb2
Message:

add polymorphic clamp routine to stdlib

Location:
src/libcfa
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/stdlib

    r1bc1bb2 ra9f2c13  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Apr 27 22:03:29 2016
    13 // Update Count     : 96
     12// Last Modified On : Thu Jun 30 15:04:18 2016
     13// Update Count     : 97
    1414//
    1515
     
    129129T max( const T t1, const T t2 );
    130130
     131forall( otype T | { T min( T, T ); T max( T, T ); } )
     132T clamp( const T value, const T min_val, const T max_val );
     133
    131134forall( otype T )
    132135void swap( T * t1, T * t2 );
  • src/libcfa/stdlib.c

    r1bc1bb2 ra9f2c13  
    1010// Created On       : Thu Jan 28 17:10:29 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Apr 28 07:54:21 2016
    13 // Update Count     : 166
     12// Last Modified On : Thu Jun 30 15:04:25 2016
     13// Update Count     : 168
    1414//
    1515
     
    254254} // max
    255255
     256forall( otype T | { T min( T, T ); T max( T, T ); } )
     257T clamp( const T value, const T min_val, const T max_val ) {
     258        return max( min_val, min( value, max_val ) );
     259} // clamp
     260
    256261forall( otype T )
    257262void swap( T * t1, T * t2 ) {
Note: See TracChangeset for help on using the changeset viewer.