Changeset a094f13


Ignore:
Timestamp:
Oct 1, 2019, 11:40:52 AM (2 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
73fad25
Parents:
722c0848 (diff), 7df201c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Files:
2 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/stdlib.hfa

    r722c0848 ra094f13  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 23 14:14:59 2019
    13 // Update Count     : 373
     12// Last Modified On : Fri Sep 27 12:09:18 2019
     13// Update Count     : 381
    1414//
    1515
     
    8181        } // alloc
    8282
     83        T * alloc( T & fill ) {
     84                return (T *)memcpy( (T *)alloc(), &fill, sizeof(T) ); // initialize with fill value
     85        } // alloc
     86
    8387        T * alloc( size_t dim ) {
    8488                if ( _Alignof(T) <= libAlign() ) return (T *)(void *)malloc( dim * (size_t)sizeof(T) ); // C malloc
     
    8892        T * alloc( size_t dim, char fill ) {
    8993                return (T *)memset( (T *)alloc( dim ), (int)fill, dim * sizeof(T) ); // initialize with fill value
     94        } // alloc
     95
     96        T * alloc( size_t dim, T & fill ) {
     97                T * r = (T *)alloc( dim );
     98                for ( i; dim ) { memcpy( &r[i], &fill, sizeof(T) ); } // initialize with fill value
     99                return r;
     100        } // alloc
     101
     102        T * alloc( size_t dim, T fill[] ) {
     103                return (T *)memcpy( (T *)alloc( dim ), fill, dim * sizeof(T) ); // initialize with fill value
    90104        } // alloc
    91105
Note: See TracChangeset for help on using the changeset viewer.