8000 GitHub - tetsuo/ring: Efficient circular buffer implementation
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

tetsuo/ring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ring

A Ring is a fixed size circular buffer.

The capacity of a buffer is always rounded up to the nearest power of 2 for optimal performance.

Example

r := ring.New[int](2)

r.Put(0, 42)
r.Put(1, 555)

fmt.Println(r.Get(0))
fmt.Println(r.Get(1))
fmt.Println(r.Get(2))
fmt.Println(r.Get(3))
fmt.Println(r.Get(4))

Output:

42
555
42
555
42

About

Efficient circular buffer implementation

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages

0