Ai
1 Star 11 Fork 3

ZX/php-code-generator

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
gconv_unsafe.go 942 Bytes
一键复制 编辑 原始数据 按行查看 历史
ZX 提交于 2023-09-16 14:26 +08:00 . 增加goravel工具库
// Copyright 2017 gf Author(https://github.com/gogf/gf). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package gconv
import "unsafe"
// UnsafeStrToBytes converts string to []byte without memory copy.
// Note that, if you completely sure you will never use <s> in the feature,
// you can use this unsafe function to implement type conversion in high performance.
func UnsafeStrToBytes(s string) []byte {
return *(*[]byte)(unsafe.Pointer(&s))
}
// UnsafeBytesToStr converts []byte to string without memory copy.
// Note that, if you completely sure you will never use <s> in the feature,
// you can use this unsafe function to implement type conversion in high performance.
func UnsafeBytesToStr(b []byte) string {
return *(*string)(unsafe.Pointer(&b))
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/open-php/php-code-generator.git
git@gitee.com:open-php/php-code-generator.git
open-php
php-code-generator
php-code-generator
v0.1.0

搜索帮助