reactor-c
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
mixed_radix.c File Reference
#include <assert.h>
#include <stdlib.h>
#include "mixed_radix.h"

Functions

void mixed_radix_incr (mixed_radix_int_t *mixed)
 
int mixed_radix_parent (mixed_radix_int_t *mixed, int n)
 
int mixed_radix_to_int (mixed_radix_int_t *mixed)
 

Detailed Description

Author
Edward A. Lee (eal@b.nosp@m.erke.nosp@m.ley.e.nosp@m.du)

LICENSE

Copyright (c) 2022, The University of California at Berkeley.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

DESCRIPTION

Functions for permuted mixed-radix numbers used in Lingua Franca programs.

See also
mixed_radix.h

Function Documentation

◆ mixed_radix_incr()

void mixed_radix_incr ( mixed_radix_int_t * mixed)

Increment the mixed radix number by one according to the permutation matrix.

Parameters
mixedA pointer to the mixed-radix number.

◆ mixed_radix_parent()

int mixed_radix_parent ( mixed_radix_int_t * mixed,
int n )

Return the int value of a mixed-radix number after dropping the first n digits. If n is larger than or equal to the size of the mixed-radix number, then return 0.

Parameters
mixedA pointer to the mixed-radix number.
nThe number of digits to drop, which is assumed to be greater than or equal to 0.

◆ mixed_radix_to_int()

int mixed_radix_to_int ( mixed_radix_int_t * mixed)

Return the int value of a mixed-radix number.

Parameters
mixedA pointer to the mixed-radix number.