summaryrefslogtreecommitdiff
path: root/vendor/github.com/tetratelabs/wazero/internal/wasm/counts.go
diff options
context:
space:
mode:
authorLibravatar Terin Stock <terinjokes@gmail.com>2025-03-09 17:47:56 +0100
committerLibravatar Terin Stock <terinjokes@gmail.com>2025-03-10 01:59:49 +0100
commit3ac1ee16f377d31a0fb80c8dae28b6239ac4229e (patch)
treef61faa581feaaeaba2542b9f2b8234a590684413 /vendor/github.com/tetratelabs/wazero/internal/wasm/counts.go
parent[chore] update URLs to forked source (diff)
downloadgotosocial-3ac1ee16f377d31a0fb80c8dae28b6239ac4229e.tar.xz
[chore] remove vendor
Diffstat (limited to 'vendor/github.com/tetratelabs/wazero/internal/wasm/counts.go')
-rw-r--r--vendor/github.com/tetratelabs/wazero/internal/wasm/counts.go51
1 files changed, 0 insertions, 51 deletions
diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/counts.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/counts.go
deleted file mode 100644
index 685a40941..000000000
--- a/vendor/github.com/tetratelabs/wazero/internal/wasm/counts.go
+++ /dev/null
@@ -1,51 +0,0 @@
-package wasm
-
-import "fmt"
-
-// SectionElementCount returns the count of elements in a given section ID
-//
-// For example...
-// * SectionIDType returns the count of FunctionType
-// * SectionIDCustom returns the count of CustomSections plus one if NameSection is present
-// * SectionIDHostFunction returns the count of HostFunctionSection
-// * SectionIDExport returns the count of unique export names
-func (m *Module) SectionElementCount(sectionID SectionID) uint32 { // element as in vector elements!
- switch sectionID {
- case SectionIDCustom:
- numCustomSections := uint32(len(m.CustomSections))
- if m.NameSection != nil {
- numCustomSections++
- }
- return numCustomSections
- case SectionIDType:
- return uint32(len(m.TypeSection))
- case SectionIDImport:
- return uint32(len(m.ImportSection))
- case SectionIDFunction:
- return uint32(len(m.FunctionSection))
- case SectionIDTable:
- return uint32(len(m.TableSection))
- case SectionIDMemory:
- if m.MemorySection != nil {
- return 1
- }
- return 0
- case SectionIDGlobal:
- return uint32(len(m.GlobalSection))
- case SectionIDExport:
- return uint32(len(m.ExportSection))
- case SectionIDStart:
- if m.StartSection != nil {
- return 1
- }
- return 0
- case SectionIDElement:
- return uint32(len(m.ElementSection))
- case SectionIDCode:
- return uint32(len(m.CodeSection))
- case SectionIDData:
- return uint32(len(m.DataSection))
- default:
- panic(fmt.Errorf("BUG: unknown section: %d", sectionID))
- }
-}