Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 20 for byteslice (0.19 sec)

  1. src/log/slog/text_handler.go

    			s.appendString(string(data))
    			return nil
    		}
    		if bs, ok := byteSlice(v.any); ok {
    			// As of Go 1.19, this only allocates for strings longer than 32 bytes.
    			s.buf.WriteString(strconv.Quote(string(bs)))
    			return nil
    		}
    		s.appendString(fmt.Sprintf("%+v", v.Any()))
    	default:
    		*s.buf = v.append(*s.buf)
    	}
    	return nil
    }
    
    // byteSlice returns its argument as a []byte if the argument's
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 23 22:56:07 UTC 2023
    - 4.7K bytes
    - Viewed (0)
  2. src/database/sql/convert_test.go

    		{s: 123, d: &scanint, wantint: 123},
    		{s: someTime, d: &scantime, wanttime: someTime},
    
    		// To strings
    		{s: "string", d: &scanstr, wantstr: "string"},
    		{s: []byte("byteslice"), d: &scanstr, wantstr: "byteslice"},
    		{s: 123, d: &scanstr, wantstr: "123"},
    		{s: int8(123), d: &scanstr, wantstr: "123"},
    		{s: int64(123), d: &scanstr, wantstr: "123"},
    		{s: uint8(123), d: &scanstr, wantstr: "123"},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 10 20:23:22 UTC 2024
    - 17K bytes
    - Viewed (0)
  3. src/cmd/compile/internal/walk/order.go

    		o.exprList(n.List)
    
    		if len(n.List) > 5 {
    			t := types.NewArray(types.Types[types.TSTRING], int64(len(n.List)))
    			n.Prealloc = o.newTemp(t, false)
    		}
    
    		// Mark string(byteSlice) arguments to reuse byteSlice backing
    		// buffer during conversion. String concatenation does not
    		// memorize the strings for later use, so it is safe.
    		// However, we can do it only if there is at least one non-empty string literal.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 08 02:00:33 UTC 2024
    - 42.7K bytes
    - Viewed (0)
  4. src/encoding/json/decode_test.go

    	NilMap   map[string]Small
    
    	Slice   []Small
    	SliceP  []*Small
    	PSlice  *[]Small
    	PSliceP *[]*Small
    
    	EmptySlice []Small
    	NilSlice   []Small
    
    	StringSlice []string
    	ByteSlice   []byte
    
    	Small   Small
    	PSmall  *Small
    	PPSmall **Small
    
    	Interface  any
    	PInterface *any
    
    	unexported int
    }
    
    type Small struct {
    	Tag string
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 11 16:40:14 UTC 2024
    - 67.6K bytes
    - Viewed (0)
  5. src/net/textproto/reader.go

    		} else if !upper && 'A' <= c && c <= 'Z' {
    			c += toLower
    		}
    		a[i] = c
    		upper = c == '-' // for next time
    	}
    	commonHeaderOnce.Do(initCommonHeader)
    	// The compiler recognizes m[string(byteSlice)] as a special
    	// case, so a copy of a's bytes into a new string does not
    	// happen in this map lookup:
    	if v := commonHeader[string(a)]; v != "" {
    		return v, true
    	}
    	return string(a), true
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 15 19:57:43 UTC 2024
    - 22.1K bytes
    - Viewed (0)
  6. src/cmd/compile/internal/walk/switch.go

    	// convert switch {...} to switch true {...}
    	if cond == nil {
    		cond = ir.NewBool(base.Pos, true)
    		cond = typecheck.Expr(cond)
    		cond = typecheck.DefaultLit(cond, nil)
    	}
    
    	// Given "switch string(byteslice)",
    	// with all cases being side-effect free,
    	// use a zero-cost alias of the byte slice.
    	// Do this before calling walkExpr on cond,
    	// because walkExpr will lower the string
    	// conversion into a runtime call.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 04 17:34:01 UTC 2024
    - 30.1K bytes
    - Viewed (0)
  7. src/debug/dwarf/type.go

    // the zero value is used.
    type CommonType struct {
    	ByteSize int64  // size of value of this type, in bytes
    	Name     string // name that can be used to refer to type
    }
    
    func (c *CommonType) Common() *CommonType { return c }
    
    func (c *CommonType) Size() int64 { return c.ByteSize }
    
    // Basic types
    
    // A BasicType holds fields common to all basic types.
    //
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Oct 18 19:33:30 UTC 2023
    - 21.9K bytes
    - Viewed (0)
  8. tensorflow/compiler/mlir/tfr/ir/tfr_types.h

      static TFRTypeStorage* construct(TypeStorageAllocator& allocator, KeyTy key) {
        // Allocate a new storage instance.
        auto byteSize = TFRTypeStorage::totalSizeToAlloc<StringAttr>(key.size());
        auto rawMem = allocator.allocate(byteSize, alignof(TFRTypeStorage));
        auto result = ::new (rawMem) TFRTypeStorage(key.size());
    
        // Copy in the string attributes into the trailing storage.
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Tue Dec 05 07:17:01 UTC 2023
    - 4.1K bytes
    - Viewed (0)
  9. test/codegen/strings.go

    func CountRunes(s string) int { // Issue #24923
    	// amd64:`.*countrunes`
    	return len([]rune(s))
    }
    
    func CountBytes(s []byte) int {
    	// amd64:-`.*runtime.slicebytetostring`
    	return len(string(s))
    }
    
    func ToByteSlice() []byte { // Issue #24698
    	// amd64:`LEAQ\ttype:\[3\]uint8`
    	// amd64:`CALL\truntime\.newobject`
    	// amd64:-`.*runtime.stringtoslicebyte`
    	return []byte("foo")
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jul 26 17:17:28 UTC 2023
    - 2.4K bytes
    - Viewed (0)
  10. src/cmd/link/internal/ld/dwarf.go

    	}
    	kind := decodetypeKind(d.arch, tdata)
    	bytesize := decodetypeSize(d.arch, tdata)
    
    	var die, typedefdie *dwarf.DWDie
    	switch kind {
    	case abi.Bool:
    		die = d.newdie(&dwtypes, dwarf.DW_ABRV_BASETYPE, name)
    		newattr(die, dwarf.DW_AT_encoding, dwarf.DW_CLS_CONSTANT, dwarf.DW_ATE_boolean, 0)
    		newattr(die, dwarf.DW_AT_byte_size, dwarf.DW_CLS_CONSTANT, bytesize, 0)
    
    	case abi.Int,
    		abi.Int8,
    		abi.Int16,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 16:25:18 UTC 2024
    - 72.4K bytes
    - Viewed (0)
Back to top