github.com/afumu/libc@v0.0.6/libc32.go (about)

     1  // Copyright 2020 The Libc Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build 386 || arm
     6  // +build 386 arm
     7  
     8  package libc // import "github.com/afumu/libc"
     9  
    10  const (
    11  	heapSize = 1 << 30 // Adjust for your debugging session requirements and system RAM size.
    12  )
    13  
    14  type (
    15  	// RawMem represents the biggest byte array the runtime can handle
    16  	RawMem [1<<31 - 1]byte
    17  
    18  	// 32-5*4 = 12 bytes left to pad
    19  	stackHeaderPadding struct {
    20  		a uintptr
    21  		b uintptr
    22  		c uintptr
    23  	}
    24  )
    25  
    26  type bits []int
    27  
    28  func newBits(n int) (r bits)  { return make(bits, (n+31)>>5) }
    29  func (b bits) has(n int) bool { return b != nil && b[n>>5]&(1<<uint(n&31)) != 0 }
    30  func (b bits) set(n int)      { b[n>>5] |= 1 << uint(n&31) }