Ignore:
Timestamp:
Oct 23, 2023, 11:58:10 AM (14 months ago)
Author:
caparson <caparson@…>
Branches:
master
Children:
edc4813
Parents:
2ad5e1d5 (diff), abb04a4 (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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/genericUnion.cfa

    r2ad5e1d5 r7b84d3e  
    1010// Created On       : Tue Dec 25 14:42:46 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Dec 25 14:46:33 2018
    13 // Update Count     : 2
     12// Last Modified On : Fri Oct 20 09:13:26 2023
     13// Update Count     : 15
    1414//
    1515
     16#include <fstream.hfa>
    1617#include <limits.hfa>
    1718
    18 forall(T)
     19forall( T )
    1920union ByteView {
    2021        T val;
     
    2324
    2425forall(T)
    25 void print(ByteView(T) x) {
    26         for (int i = 0; i < sizeof(int); i++) {                         // want to change to sizeof(T)
    27                 printf("%02x", x.bytes[i] & 0xff);
     26void print( ByteView(T) x ) {
     27        for ( i; sizeof(int) ) {                                                        // want to change to sizeof(T)
     28                sout | nobase( pad0( wd( 2, hex( x.bytes[i] & 0xff ) ) ) ) | nosep;
    2829        }
    2930}
    3031
    3132forall(T)
    32 void f(ByteView(T) x, T val) {
    33         print(x);
    34         printf(" ");
     33void f( ByteView(T) x, T val ) {
     34        print( x );
     35        sout | " ";
    3536        x.val = val;
    36         print(x);
    37         printf("\n");
     37        print( x );
     38        sout | nl;
    3839}
    3940
    4041int main() {
     42        sout | nlOff;
    4143        ByteView(unsigned) u = { 0 };
    4244        ByteView(int) i = { 0 };
    43         f(u, MAX);
    44         f(i, -1);
     45        f( u, MAX );
     46        f( i, -1 );
    4547}
    4648
Note: See TracChangeset for help on using the changeset viewer.