Sha256: daec1ffea456731dee0f3e7c5557dade2db1410efbbc2cc2a9c7bfb8da5828fe

Contents?: true

Size: 1.1 KB

Versions: 16

Compression:

Stored size: 1.1 KB

Contents

package brotli

/* Copyright 2016 Google Inc. All Rights Reserved.

   Distributed under MIT license.
   See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
*/

/*
Dynamically grows array capacity to at least the requested size
T: data type
A: array
C: capacity
R: requested size
*/
func brotli_ensure_capacity_uint8_t(a *[]byte, c *uint, r uint) {
	if *c < r {
		var new_size uint = *c
		if new_size == 0 {
			new_size = r
		}

		for new_size < r {
			new_size *= 2
		}

		if cap(*a) < int(new_size) {
			var new_array []byte = make([]byte, new_size)
			if *c != 0 {
				copy(new_array, (*a)[:*c])
			}

			*a = new_array
		} else {
			*a = (*a)[:new_size]
		}

		*c = new_size
	}
}

func brotli_ensure_capacity_uint32_t(a *[]uint32, c *uint, r uint) {
	var new_array []uint32
	if *c < r {
		var new_size uint = *c
		if new_size == 0 {
			new_size = r
		}

		for new_size < r {
			new_size *= 2
		}

		if cap(*a) < int(new_size) {
			new_array = make([]uint32, new_size)
			if *c != 0 {
				copy(new_array, (*a)[:*c])
			}

			*a = new_array
		} else {
			*a = (*a)[:new_size]
		}
		*c = new_size
	}
}

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ruby_snowflake_client-1.3.7 ext/vendor/github.com/andybalholm/brotli/memory.go
ruby_snowflake_client-1.3.6 ext/vendor/github.com/andybalholm/brotli/memory.go
ruby_snowflake_client-1.3.5 ext/vendor/github.com/andybalholm/brotli/memory.go
ruby_snowflake_client-1.3.4 ext/vendor/github.com/andybalholm/brotli/memory.go
ruby_snowflake_client-1.3.4.pre.debug ext/vendor/github.com/andybalholm/brotli/memory.go
ruby_snowflake_client-1.3.3.pre.debug ext/vendor/github.com/andybalholm/brotli/memory.go
ruby_snowflake_client-1.3.2 ext/vendor/github.com/andybalholm/brotli/memory.go
ruby_snowflake_client-1.3.1 ext/vendor/github.com/andybalholm/brotli/memory.go
ruby_snowflake_client-1.3.0 ext/vendor/github.com/andybalholm/brotli/memory.go
ruby_snowflake_client-1.2.1 ext/vendor/github.com/andybalholm/brotli/memory.go
ruby_snowflake_client-1.2.0 ext/vendor/github.com/andybalholm/brotli/memory.go
ruby_snowflake_client-1.1.1 ext/vendor/github.com/andybalholm/brotli/memory.go
ruby_snowflake_client-1.1.0 ext/vendor/github.com/andybalholm/brotli/memory.go
ruby_snowflake_client-1.0.2 ext/vendor/github.com/andybalholm/brotli/memory.go
ruby_snowflake_client-1.0.1 ext/vendor/github.com/andybalholm/brotli/memory.go
ruby_snowflake_client-1.0.0 ext/vendor/github.com/andybalholm/brotli/memory.go