Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 for encoderFunc (0.37 sec)

  1. src/encoding/json/encode.go

    	escapeHTML bool
    }
    
    type encoderFunc func(e *encodeState, v reflect.Value, opts encOpts)
    
    var encoderCache sync.Map // map[reflect.Type]encoderFunc
    
    func valueEncoder(v reflect.Value) encoderFunc {
    	if !v.IsValid() {
    		return invalidValueEncoder
    	}
    	return typeEncoder(v.Type())
    }
    
    func typeEncoder(t reflect.Type) encoderFunc {
    	if fi, ok := encoderCache.Load(t); ok {
    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/vendor/golang.org/x/text/unicode/norm/composition.go

    func decomposeHangul(buf []byte, r rune) int {
    	const JamoUTF8Len = 3
    	r -= hangulBase
    	x := r % jamoTCount
    	r /= jamoTCount
    	utf8.EncodeRune(buf, jamoLBase+r/jamoVCount)
    	utf8.EncodeRune(buf[JamoUTF8Len:], jamoVBase+r%jamoVCount)
    	if x != 0 {
    		utf8.EncodeRune(buf[2*JamoUTF8Len:], jamoTBase+x)
    		return 3 * JamoUTF8Len
    	}
    	return 2 * JamoUTF8Len
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 26 19:27:51 UTC 2019
    - 14.1K bytes
    - Viewed (0)
  3. src/cmd/vendor/golang.org/x/text/unicode/norm/composition.go

    func decomposeHangul(buf []byte, r rune) int {
    	const JamoUTF8Len = 3
    	r -= hangulBase
    	x := r % jamoTCount
    	r /= jamoTCount
    	utf8.EncodeRune(buf, jamoLBase+r/jamoVCount)
    	utf8.EncodeRune(buf[JamoUTF8Len:], jamoVBase+r%jamoVCount)
    	if x != 0 {
    		utf8.EncodeRune(buf[2*JamoUTF8Len:], jamoTBase+x)
    		return 3 * JamoUTF8Len
    	}
    	return 2 * JamoUTF8Len
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jan 24 13:01:26 UTC 2024
    - 14.1K bytes
    - Viewed (0)
  4. src/unicode/utf8/utf8_test.go

    		}
    	}
    }
    
    func TestEncodeRune(t *testing.T) {
    	for _, m := range utf8map {
    		b := []byte(m.str)
    		var buf [10]byte
    		n := EncodeRune(buf[0:], m.r)
    		b1 := buf[0:n]
    		if !bytes.Equal(b, b1) {
    			t.Errorf("EncodeRune(%#04x) = %q want %q", m.r, b1, b)
    		}
    	}
    }
    
    func TestAppendRune(t *testing.T) {
    	for _, m := range utf8map {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Sep 07 06:17:15 UTC 2022
    - 16.2K bytes
    - Viewed (0)
  5. src/runtime/string.go

    	}
    	var dum [4]byte
    	size1 := 0
    	for _, r := range a {
    		size1 += encoderune(dum[:], r)
    	}
    	s, b := rawstringtmp(buf, size1+3)
    	size2 := 0
    	for _, r := range a {
    		// check for race
    		if size2 >= size1 {
    			break
    		}
    		size2 += encoderune(b[size2:], r)
    	}
    	return s[:size2]
    }
    
    type stringStruct struct {
    	str unsafe.Pointer
    	len int
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:17:26 UTC 2024
    - 13.4K bytes
    - Viewed (0)
  6. staging/src/k8s.io/apiserver/pkg/endpoints/handlers/response.go

    func (e *watchEncoder) Encode(event watch.Event) error {
    	encodeFunc := func(obj runtime.Object, w io.Writer) error {
    		return e.doEncode(obj, event, w)
    	}
    	if co, ok := event.Object.(runtime.CacheableObject); ok {
    		return co.CacheEncode(e.identifier(event.Type), encodeFunc, e.framer)
    	}
    	return encodeFunc(event.Object, e.framer)
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Oct 18 09:07:03 UTC 2023
    - 16.5K bytes
    - Viewed (0)
  7. src/unicode/utf8/utf8.go

    	case r <= rune3Max:
    		return 3
    	case r <= MaxRune:
    		return 4
    	}
    	return -1
    }
    
    // EncodeRune writes into p (which must be large enough) the UTF-8 encoding of the rune.
    // If the rune is out of range, it writes the encoding of [RuneError].
    // It returns the number of bytes written.
    func EncodeRune(p []byte, r rune) int {
    	// Negative values are erroneous. Making it unsigned addresses the problem.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 08 02:00:36 UTC 2024
    - 16.4K bytes
    - Viewed (0)
  8. src/encoding/json/decode.go

    						// A valid pair; consume.
    						r += 6
    						w += utf8.EncodeRune(b[w:], dec)
    						break
    					}
    					// Invalid surrogate; fall back to replacement rune.
    					rr = unicode.ReplacementChar
    				}
    				w += utf8.EncodeRune(b[w:], rr)
    			}
    
    		// Quote, control characters are invalid.
    		case c == '"', c < ' ':
    			return
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 00:18:55 UTC 2024
    - 35.3K bytes
    - Viewed (0)
  9. src/bytes/buffer_test.go

    func TestRuneIO(t *testing.T) {
    	const NRune = 1000
    	// Built a test slice while we write the data
    	b := make([]byte, utf8.UTFMax*NRune)
    	var buf Buffer
    	n := 0
    	for r := rune(0); r < NRune; r++ {
    		size := utf8.EncodeRune(b[n:], r)
    		nbytes, err := buf.WriteRune(r)
    		if err != nil {
    			t.Fatalf("WriteRune(%U) error: %s", r, err)
    		}
    		if nbytes != size {
    			t.Fatalf("WriteRune(%U) expected %d, got %d", r, size, nbytes)
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 26 13:31:36 UTC 2024
    - 18.6K bytes
    - Viewed (0)
  10. src/cmd/compile/internal/types2/typestring.go

    func subscript(x uint64) string {
    	const w = len("₀") // all digits 0...9 have the same utf8 width
    	var buf [32 * w]byte
    	i := len(buf)
    	for {
    		i -= w
    		utf8.EncodeRune(buf[i:], '₀'+rune(x%10)) // '₀' == U+2080
    		x /= 10
    		if x == 0 {
    			break
    		}
    	}
    	return string(buf[i:])
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 12.2K bytes
    - Viewed (0)
Back to top