Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 42 for typehash (0.13 sec)

  1. src/runtime/alg.go

    		// typehash, but we want to report the topmost type in
    		// the error text (e.g. in a struct with a field of slice type
    		// we want to report the struct, not the slice).
    		panic(errorString("hash of unhashable type " + toRType(t).string()))
    	}
    	if isDirectIface(t) {
    		return c1 * typehash(t, unsafe.Pointer(&a.data), h^c0)
    	} else {
    		return c1 * typehash(t, a.data, h^c0)
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 17:58:53 UTC 2024
    - 13.6K bytes
    - Viewed (0)
  2. test/fixedbugs/issue37716.go

    package main
    
    import "reflect"
    
    // complicated enough to require a compile-generated hash function
    type K struct {
    	a, b int32 // these get merged by the compiler into a single field, something typehash doesn't do
    	c    float64
    }
    
    func main() {
    	k := K{a: 1, b: 2, c: 3}
    
    	// Make a reflect map.
    	m := reflect.MakeMap(reflect.MapOf(reflect.TypeOf(K{}), reflect.TypeOf(true)))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 10 16:26:59 UTC 2020
    - 872 bytes
    - Viewed (0)
  3. src/runtime/type.go

    			} else {
    				t = prev.typemap[typeOff(tl)]
    			}
    			// Add to typehash if not seen before.
    			tlist := typehash[t.Hash]
    			for _, tcur := range tlist {
    				if tcur == t {
    					continue collect
    				}
    			}
    			typehash[t.Hash] = append(tlist, t)
    		}
    
    		if md.typemap == nil {
    			// If any of this module's typelinks match a type from a
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:17:26 UTC 2024
    - 12.7K bytes
    - Viewed (0)
  4. src/cmd/compile/internal/types/fmt.go

    		i--
    	}
    	const dot = "ยท"
    	if i >= len(dot) && name[i-len(dot):i] == dot {
    		i -= len(dot)
    		return name[:i], name[i:]
    	}
    	return name, ""
    }
    
    // TypeHash computes a hash value for type t to use in type switch statements.
    func TypeHash(t *Type) uint32 {
    	p := t.LinkString()
    
    	// Using SHA256 is overkill, but reduces accidental collisions.
    	h := notsha256.Sum256([]byte(p))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 12 15:41:17 UTC 2023
    - 15.7K bytes
    - Viewed (0)
  5. src/cmd/compile/internal/types2/typestring.go

    				w.string(f.pkg.Path())
    				w.string(" */ ")
    			}
    			if tag := t.Tag(i); tag != "" {
    				w.byte(' ')
    				// TODO(gri) If tag contains blanks, replacing them with '#'
    				//           in Context.TypeHash may produce another tag
    				//           accidentally.
    				w.string(strconv.Quote(tag))
    			}
    		}
    		w.byte('}')
    
    	case *Pointer:
    		w.byte('*')
    		w.typ(t.base)
    
    	case *Tuple:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 12.2K bytes
    - Viewed (0)
  6. src/go/types/typestring.go

    				w.string(f.pkg.Path())
    				w.string(" */ ")
    			}
    			if tag := t.Tag(i); tag != "" {
    				w.byte(' ')
    				// TODO(gri) If tag contains blanks, replacing them with '#'
    				//           in Context.TypeHash may produce another tag
    				//           accidentally.
    				w.string(strconv.Quote(tag))
    			}
    		}
    		w.byte('}')
    
    	case *Pointer:
    		w.byte('*')
    		w.typ(t.base)
    
    	case *Tuple:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 12.3K bytes
    - Viewed (0)
  7. src/cmd/compile/internal/types2/stmt.go

    				err.report()
    				continue L
    			}
    		}
    		seen[T] = e
    		if x != nil && T != nil {
    			check.typeAssertion(e, x, T, true)
    		}
    	}
    	return
    }
    
    // TODO(gri) Once we are certain that typeHash is correct in all situations, use this version of caseTypes instead.
    // (Currently it may be possible that different types have identical names and import paths due to ImporterFrom.)
    //
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 30.7K bytes
    - Viewed (0)
  8. src/go/types/stmt.go

    				err.report()
    				continue L
    			}
    		}
    		seen[T] = e
    		if x != nil && T != nil {
    			check.typeAssertion(e, x, T, true)
    		}
    	}
    	return
    }
    
    // TODO(gri) Once we are certain that typeHash is correct in all situations, use this version of caseTypes instead.
    // (Currently it may be possible that different types have identical names and import paths due to ImporterFrom.)
    //
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 30.6K bytes
    - Viewed (0)
  9. src/cmd/compile/internal/walk/switch.go

    					[]ir.Node{ir.NewTypeAssertExpr(c.pos, s.srcName, c.typ.Type())}) // iface.(type)
    				nif := ir.NewIfStmt(c.pos, s.okName, []ir.Node{c.jmp}, nil)
    				clauses = append(clauses, typeClause{
    					hash: types.TypeHash(c.typ.Type()),
    					body: []ir.Node{typecheck.Stmt(as), typecheck.Stmt(nif)},
    				})
    			}
    			s.flush(clauses, &sw.Compiled)
    			concreteCases = concreteCases[:0]
    		}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 04 17:34:01 UTC 2024
    - 30.1K bytes
    - Viewed (0)
  10. src/runtime/map_test.go

    }
    
    type canString int
    
    func (c canString) String() string {
    	return fmt.Sprintf("%d", int(c))
    }
    
    func TestMapInterfaceKey(t *testing.T) {
    	// Test all the special cases in runtime.typehash.
    	type GrabBag struct {
    		f32  float32
    		f64  float64
    		c64  complex64
    		c128 complex128
    		s    string
    		i0   any
    		i1   interface {
    			String() string
    		}
    		a [4]string
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 33.5K bytes
    - Viewed (0)
Back to top