google / google/xls

DSLX: for loop striding [was: Question: for loop in DSLX]

Open
#401 4 comments 0 reactions 0 assignees View on GitHub
dslx enhancement long-term-enhancement
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

Hello!

Please, say, how to write the following C code in DSLX

```cpp
while (nibble_count > 1) {
output[byte_count++] = (nibbles[0] << 4) + nibbles[1];
nibbles[0] = nibbles[2];
nibbles[1] = nibbles[3];
nibbles[2] = nibbles[4];
nibbles[3] = nibbles[5];
nibble_count -= 2;
}
```
The problem is that I saw in the DSLX language only loops based on range () - there the iteration goes in ascending order, with increasing the counter by 1

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.