runtime/wasm: add memset()
Copied from the ARM runtime and modified to return a pointer. https://pubs.opengroup.org/onlinepubs/9699919799/functions/memset.html
Этот коммит содержится в:
		
							родитель
							
								
									95e18f36d0
								
							
						
					
					
						коммит
						67fbfe6305
					
				
					 1 изменённых файлов: 12 добавлений и 0 удалений
				
			
		| 
						 | 
					@ -2,6 +2,10 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package runtime
 | 
					package runtime
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"unsafe"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type timeUnit int64
 | 
					type timeUnit int64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const tickMicros = 1
 | 
					const tickMicros = 1
 | 
				
			||||||
| 
						 | 
					@ -48,3 +52,11 @@ func ticks() timeUnit {
 | 
				
			||||||
func abort() {
 | 
					func abort() {
 | 
				
			||||||
	trap()
 | 
						trap()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:export memset
 | 
				
			||||||
 | 
					func memset(ptr unsafe.Pointer, c byte, size uintptr) unsafe.Pointer {
 | 
				
			||||||
 | 
						for i := uintptr(0); i < size; i++ {
 | 
				
			||||||
 | 
							*(*byte)(unsafe.Pointer(uintptr(ptr) + i)) = c
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return ptr
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Загрузка…
	
	Создание таблицы
		
		Сослаться в новой задаче