summaryrefslogtreecommitdiff
path: root/vendor/github.com/tetratelabs/wazero/internal/wasip1/wasi.go
blob: 299feea2f9341d3ad6f8cf9afe92b3af9f3a8c5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Package wasip1 is a helper to remove package cycles re-using constants.
package wasip1

import (
	"strings"
)

// InternalModuleName is not named ModuleName, to avoid a clash on dot imports.
const InternalModuleName = "wasi_snapshot_preview1"

func flagsString(names []string, f int) string {
	var builder strings.Builder
	first := true
	for i, sf := range names {
		target := 1 << i
		if target&f != 0 {
			if !first {
				builder.WriteByte('|')
			} else {
				first = false
			}
			builder.WriteString(sf)
		}
	}
	return builder.String()
}