Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • pystencils pystencils
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 17
    • Issues 17
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • pycodegen
  • pystencilspystencils
  • Merge requests
  • !257

Merged
Created Jul 02, 2021 by Frederik Hennig@da15siwaContributor

Bit Flag Conditional

  • Overview 2
  • Commits 5
  • Pipelines 3
  • Changes 3

This MR introduces a bit flag conditional that acts like a ternary operator for a single bit flag. It takes at least three arguments:

  • flag_bit specifies which bit of the mask is examined
  • mask_expression is an integer-typed expression which acts as a bit mask
  • then_expression is a SymPy expression of arbitrary type, and
  • optionally else_expression is a SymPy expression of arbitrary type

flag_cond examines the given bit of the given mask and takes the value of then_expression if the bit is set to 1. If not, it becomes either 0 or else_expression:

Three argument version:

    flag_cond(flag_bit, mask, expr) = expr if (flag_bit is set in mask) else 0

Four argument version:

    flag_cond(flag_bit, mask, expr_then, expr_else) = expr_then if (flag_bit is set in mask) else expr_else
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: bit_masks