| 1 |
// Package wasip1 is a helper to remove package cycles re-using constants. |
| 2 |
package wasip1 |
| 3 |
|
| 4 |
import ( |
| 5 |
"strings" |
| 6 |
) |
| 7 |
|
| 8 |
// InternalModuleName is not named ModuleName, to avoid a clash on dot imports. |
| 9 |
const InternalModuleName = "wasi_snapshot_preview1" |
| 10 |
|
| 11 |
func flagsString(names []string, f int) string { |
| 12 |
var builder strings.Builder |
| 13 |
first := true |
| 14 |
for i, sf := range names { |
| 15 |
target := 1 << i |
| 16 |
if target&f != 0 { |
| 17 |
if !first { |
| 18 |
builder.WriteByte('|') |
| 19 |
} else { |
| 20 |
first = false |
| 21 |
} |
| 22 |
builder.WriteString(sf) |
| 23 |
} |
| 24 |
} |
| 25 |
return builder.String() |
| 26 |
} |