Source file test/codegen/unique.go

     1  // asmcheck
     2  
     3  // Copyright 2015 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  package codegen
     8  
     9  import "unique"
    10  
    11  func BytesToHandle(b []byte) unique.Handle[string] {
    12  	// amd64:-`.*runtime\.slicebytetostring\(`
    13  	return unique.Make(string(b))
    14  }
    15  
    16  type Pair struct {
    17  	S1 string
    18  	S2 string
    19  }
    20  
    21  func BytesPairToHandle(b1, b2 []byte) unique.Handle[Pair] {
    22  	// TODO: should not copy b1 and b2.
    23  	return unique.Make(Pair{string(b1), string(b2)})
    24  }
    25  

View as plain text