github.com/cellofellow/gopkg@v0.0.0-20140722061823-eec0544a62ad/database/leveldb/conv.go (about) 1 // Copyright 2013 <chaishushan{AT}gmail.com>. 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 package leveldb 6 7 import "C" 8 9 func boolToUchar(b bool) C.uchar { 10 if b { 11 return C.uchar(1) 12 } 13 return C.uchar(0) 14 } 15 16 func ucharToBool(uc C.uchar) bool { 17 if uc == C.uchar(0) { 18 return false 19 } 20 return true 21 }