Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 7 of 7 for encodeState (0.13 sec)

  1. src/encoding/json/encode.go

    var encodeStatePool sync.Pool
    
    func newEncodeState() *encodeState {
    	if v := encodeStatePool.Get(); v != nil {
    		e := v.(*encodeState)
    		e.Reset()
    		if len(e.ptrSeen) > 0 {
    			panic("ptrEncoder.encode should have emptied ptrSeen via defers")
    		}
    		e.ptrLevel = 0
    		return e
    	}
    	return &encodeState{ptrSeen: make(map[any]struct{})}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 00:18:55 UTC 2024
    - 36.2K bytes
    - Viewed (0)
  2. src/encoding/json/bench_test.go

    				b.Fatal("Marshal error: got nil, want non-nil")
    			}
    		}
    	}
    }
    
    func BenchmarkMarshalBytes(b *testing.B) {
    	b.ReportAllocs()
    	// 32 fits within encodeState.scratch.
    	b.Run("32", benchMarshalBytes(32))
    	// 256 doesn't fit in encodeState.scratch, but is small enough to
    	// allocate and avoid the slower base64.NewEncoder.
    	b.Run("256", benchMarshalBytes(256))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 15:00:17 UTC 2024
    - 12.5K bytes
    - Viewed (0)
  3. src/encoding/gob/enc_helpers.go

    	reflect.Uint64:     encUint64Slice,
    	reflect.Uintptr:    encUintptrSlice,
    }
    
    func encBoolArray(state *encoderState, v reflect.Value) bool {
    	// Can only slice if it is addressable.
    	if !v.CanAddr() {
    		return false
    	}
    	return encBoolSlice(state, v.Slice(0, v.Len()))
    }
    
    func encBoolSlice(state *encoderState, v reflect.Value) bool {
    	slice, ok := v.Interface().([]bool)
    	if !ok {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Mar 10 17:50:11 UTC 2018
    - 9.9K bytes
    - Viewed (0)
  4. src/encoding/gob/encoder.go

    	sent       map[reflect.Type]typeId // which types we've already sent
    	countState *encoderState           // stage for writing counts
    	freeList   *encoderState           // list of free encoderStates; avoids reallocation
    	byteBuf    encBuffer               // buffer for top-level encoderState
    	err        error
    }
    
    // Before we encode a message, we reserve space at the head of the
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 08 19:04:28 UTC 2023
    - 7.8K bytes
    - Viewed (0)
  5. src/encoding/gob/encode.go

    	"sync"
    )
    
    const uint64Size = 8
    
    type encHelper func(state *encoderState, v reflect.Value) bool
    
    // encoderState is the global execution state of an instance of the encoder.
    // Field numbers are delta encoded and always increase. The field
    // number is initialized to -1 so 0 comes out as delta(1). A delta of
    // 0 terminates the structure.
    type encoderState struct {
    	enc      *Encoder
    	b        *encBuffer
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 16 02:00:26 UTC 2024
    - 19K bytes
    - Viewed (0)
  6. src/encoding/gob/encgen.go

    import (
    	"reflect"
    )
    
    `
    
    const arrayHelper = `
    func enc%[2]sArray(state *encoderState, v reflect.Value) bool {
    	// Can only slice if it is addressable.
    	if !v.CanAddr() {
    		return false
    	}
    	return enc%[2]sSlice(state, v.Slice(0, v.Len()))
    }
    `
    
    const sliceHelper = `
    func enc%[2]sSlice(state *encoderState, v reflect.Value) bool {
    	slice, ok := v.Interface().([]%[1]s)
    	if !ok {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 22 16:39:09 UTC 2024
    - 3.8K bytes
    - Viewed (0)
  7. src/encoding/gob/codec_test.go

    func newDecodeState(buf *decBuffer) *decoderState {
    	d := new(decoderState)
    	d.b = buf
    	return d
    }
    
    func newEncoderState(b *encBuffer) *encoderState {
    	b.Reset()
    	state := &encoderState{enc: nil, b: b}
    	state.fieldnum = -1
    	return state
    }
    
    // Test instruction execution for encoding.
    // Do not run the machine yet; instead do individual instructions crafted by hand.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Aug 19 23:03:14 UTC 2023
    - 36.9K bytes
    - Viewed (0)
Back to top