Changeset f6a4917


Ignore:
Timestamp:
Aug 25, 2022, 10:43:36 PM (20 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, master, pthread-emulation
Children:
51fbba5
Parents:
d2f09e4
Message:

change C loop control to CFA loop control

Location:
libcfa/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/iostream.cfa

    rd2f09e4 rf6a4917  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jan 19 08:15:53 2022
    13 // Update Count     : 1352
     12// Last Modified On : Thu Aug 25 18:05:49 2022
     13// Update Count     : 1354
    1414//
    1515
     
    197197                        fmt( os, "%s", buf ); \
    198198                        if ( isfinite( val ) ) { /* if number, print decimal point when no fraction or exponent */ \
    199                                 for ( int i = 0;; i += 1 ) { \
     199                                for ( i; 0 ~ @ ) { \
    200200                                        if ( i == len ) { fmt( os, "." ); break; } \
    201201                                        if ( buf[i] == '.' || buf[i] == 'e' || buf[i] == 'E' ) break; /* decimal point or scientific ? */ \
  • libcfa/src/rational.cfa

    rd2f09e4 rf6a4917  
    1010// Created On       : Wed Apr  6 17:54:28 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 20 16:30:06 2021
    13 // Update Count     : 193
     12// Last Modified On : Thu Aug 25 18:09:58 2022
     13// Update Count     : 194
    1414//
    1515
     
    2626        // rationals.  alternative: https://en.wikipedia.org/wiki/Binary_GCD_algorithm
    2727        static T gcd( T a, T b ) {
    28                 for ( ;; ) {                                                                    // Euclid's algorithm
     28                for () {                                                                                // Euclid's algorithm
    2929                        T r = a % b;
    3030                  if ( r == (T){0} ) break;
     
    246246
    247247        // find terms until denom gets too big
    248         for ( ;; ) {
     248        for () {
    249249                ai = convert( f );
    250250          if ( ! (m10 * ai + m11 <= md) ) break;
  • libcfa/src/stdlib.cfa

    rd2f09e4 rf6a4917  
    1010// Created On       : Thu Jan 28 17:10:29 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 10 22:41:39 2022
    13 // Update Count     : 602
     12// Last Modified On : Thu Aug 25 22:41:14 2022
     13// Update Count     : 604
    1414//
    1515
     
    3535T * anew( size_t dim, TT p ) {
    3636        T * arr = alloc( dim );
    37         for ( unsigned int i = 0; i < dim; i += 1 ) {
     37        for ( i; dim ) {
    3838                (arr[i]){ p };                                                                  // run constructor
    3939        } // for
     
    4545        if ( arr ) {                                                                            // ignore null
    4646                size_t dim = malloc_size( arr ) / sizeof( T );
    47                 for ( int i = dim - 1; i >= 0; i -= 1 ) {               // reverse allocation order, must be unsigned
     47                for ( i; 0 -~= dim - 1 ) {                                              // reverse allocation order, must be unsigned
    4848                        ^(arr[i]){};                                                            // run destructor
    4949                } // for
     
    5656        if ( arr ) {                                                                            // ignore null
    5757                size_t dim = malloc_size( arr ) / sizeof( T );
    58                 for ( int i = dim - 1; i >= 0; i -= 1 ) {               // reverse allocation order, must be unsigned
     58                for ( i; 0 -~= dim - 1 ) {                                              // reverse allocation order, must be unsigned
    5959                        ^(arr[i]){};                                                            // run destructor
    6060                } // for
  • libcfa/src/stdlib.hfa

    rd2f09e4 rf6a4917  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Apr 18 17:57:36 2022
    13 // Update Count     : 644
     12// Last Modified On : Thu Aug 25 18:07:06 2022
     13// Update Count     : 645
    1414//
    1515
     
    192192                        memset( (char *)ptr + copy_end, (int)Fill.c, Dim * size - copy_end );
    193193                } else if ( Fill.tag == 't' ) {
    194                         for ( int i = copy_end; i < Dim * size; i += size ) {
     194                        for ( i; copy_end ~ Dim * size ~ size ) {
    195195                                #pragma GCC diagnostic push
    196196                                #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
Note: See TracChangeset for help on using the changeset viewer.