Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • sac2c sac2c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 394
    • Issues 394
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 24
    • Merge requests 24
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Merge requests
  • !71

Inctroducing new DIM_T struct type for TYPES_DIM, ICM, and others

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Grzegorz Goral requested to merge gg3/sac2c:making-dim-struct into develop Oct 09, 2018
  • Overview 23
  • Commits 67
  • Changes 125

This work will change the definitions of dim across the system to replace the current encoded dim. This mainly occurs through usage of TYPES_DIM and TCgetShapeDim, but other dim usage shall be changed for possible future development that may find the dim_t implementation more useful.

The definition of dim_t is:

typedef struct DIM_T {
    size_t val;
    bool f_array_or_scalar: 1;
    bool f_known_shape: 1;
    bool f_known_dimension: 1;
} dim_t;

The tests created to verify correct function of TCgetShapeDim currently highlight the possible types of dim results. These(with slight modification to use the struct instead of an int) will aid in later verifying that the modified dim still produces the required results.

This is the transition between the old and new definitions which shall be used to refactor the old usage of encoded dim:

TYPES_DIM can have the following values (and meanings):
*  array, shape and dimension are know                 dim > SCALAR           =>  val > SCALAR && f_known_shape
*  array, shape is not known, dimension is known       dim < KNOWN_DIM_OFFSET =>  val > SCALAR && f_known_dimension
*  array, shape and dimension is not known             dim == UNKNOWN_SHAPE   =>  !f_known_shape && !f_known_dimension && 
                                                                                  !f_array_or_scalar
*  array or scalar, shape and dimension are not known  dim == ARRAY_OR_SCALAR =>  f_array_or_scalar
*  scalar, shape and dimension are known               dim == SCALAR         =>   val == SCALAR && f_known_shape

Edit: Had to change flags for UNKNOWN_SHAPE to also check array_or_scalar as the previous check of only known shape or dimension was not enough. This would have left the chance that an array_or_scalar dim would also be unknown_shape, which is impossible following the rules of the previous version.

Edited Nov 30, 2018 by Grzegorz Goral
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: making-dim-struct