golang.org/x/net@v0.25.1-0.20240516223405-c87a5b62e243/quic/math.go (about)

     1  // Copyright 2023 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build go1.21
     6  
     7  package quic
     8  
     9  func abs[T ~int | ~int64](a T) T {
    10  	if a < 0 {
    11  		return -a
    12  	}
    13  	return a
    14  }