reorganize: consolidate demo directories
- Consolidate _demo, _pydemo, _embdemo into single _demo directory structure
- Organize demos by language: _demo/{go,py,c,embed}/
- Categorize demos based on imports:
- Python library demos (py imports) → _demo/py/
- C/C++ library demos (c/cpp imports) → _demo/c/
- Go-specific demos → _demo/go/
- Embedded demos → _demo/embed/
- Move C-related demos (asm*, cabi*, cgo*, linkname, targetsbuild) from go/ to c/
- Update all path references in README.md and GitHub workflows
- Improve demo organization and navigation as requested in #1256
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
39
_demo/c/cabisret/main.go
Normal file
39
_demo/c/cabisret/main.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package main
|
||||
|
||||
type array9 struct {
|
||||
x [9]float32
|
||||
}
|
||||
|
||||
func demo1(a array9) array9 {
|
||||
a.x[0] += 1
|
||||
return a
|
||||
}
|
||||
|
||||
func demo2(a array9) array9 {
|
||||
for i := 0; i < 1024*128; i++ {
|
||||
a = demo1(a)
|
||||
}
|
||||
return a
|
||||
}
|
||||
|
||||
func testDemo() {
|
||||
ar := array9{x: [9]float32{1, 2, 3, 4, 5, 6, 7, 8, 9}}
|
||||
for i := 0; i < 1024*128; i++ {
|
||||
ar = demo1(ar)
|
||||
}
|
||||
ar = demo2(ar)
|
||||
println(ar.x[0], ar.x[1])
|
||||
}
|
||||
|
||||
func testSlice() {
|
||||
var b []byte
|
||||
for i := 0; i < 1024*128; i++ {
|
||||
b = append(b, byte(i))
|
||||
}
|
||||
_ = b
|
||||
}
|
||||
|
||||
func main() {
|
||||
testDemo()
|
||||
testSlice()
|
||||
}
|
||||
Reference in New Issue
Block a user