mirror of
https://github.com/minio/minio.git
synced 2025-01-11 23:13:23 -05:00
Implement crc32c for Darwin, update documentation
This commit is contained in:
parent
727a8669fa
commit
01d15ca3b2
@ -50,9 +50,9 @@ This installation document assumes Mac OSX Yosemite 10.10 or later on x86-64 pla
|
||||
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||
```
|
||||
|
||||
##### Install Git and GCC
|
||||
##### Install Git
|
||||
```sh
|
||||
$ brew install git gcc
|
||||
$ brew install git
|
||||
```
|
||||
|
||||
##### Install YASM
|
||||
@ -64,7 +64,6 @@ $ brew install yasm
|
||||
```
|
||||
|
||||
##### Install Go 1.4+
|
||||
|
||||
On MacOSX ``brew.sh`` is the best way to install golang
|
||||
|
||||
For example:
|
||||
|
7
Makefile
7
Makefile
@ -1,7 +1,6 @@
|
||||
#GOPATH := $(CURDIR)/tmp/gopath
|
||||
MAKE_OPTIONS := -s
|
||||
ARCH := $(shell uname -s)
|
||||
GCCVERSIONGTEQ4 := $(shell expr `gcc -dumpversion | cut -f1 -d.` \>= 4)
|
||||
|
||||
all: getdeps install
|
||||
|
||||
@ -20,13 +19,7 @@ build-utils:
|
||||
@godep go test -race -coverprofile=cover.out github.com/minio-io/minio/pkg/utils/crypto/sha1
|
||||
@godep go test -race -coverprofile=cover.out github.com/minio-io/minio/pkg/utils/crypto/sha256
|
||||
@godep go test -race -coverprofile=cover.out github.com/minio-io/minio/pkg/utils/crypto/sha512
|
||||
ifeq ($(ARCH), Darwin)
|
||||
ifeq ($(GCCVERSIONGTEQ4), "1")
|
||||
@godep go test -race -coverprofile=cover.out github.com/minio-io/minio/pkg/utils/checksum/crc32c
|
||||
endif
|
||||
else
|
||||
@godep go test -race -coverprofile=cover.out github.com/minio-io/minio/pkg/utils/checksum/crc32c
|
||||
endif
|
||||
|
||||
#build-os:
|
||||
# @godep go test -race -coverprofile=cover.out github.com/minio-io/minio/pkg/os/scsi
|
||||
|
@ -23,7 +23,7 @@ Minio's design is inspired by Amazon's S3 for its API and Facebook's Haystack fo
|
||||
| ------------- | ------------- |
|
||||
| Linux | Yes |
|
||||
| Windows | Not yet |
|
||||
| Mac OSX | Yes(with GCC) |
|
||||
| Mac OSX | Yes |
|
||||
|
||||
### Supported architectures
|
||||
|
||||
|
35
pkg/utils/checksum/crc32c/crc32c_darwin.go
Normal file
35
pkg/utils/checksum/crc32c/crc32c_darwin.go
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Mini Object Storage, (C) 2014 Minio, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// +build amd64
|
||||
|
||||
package crc32c
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"hash/crc32"
|
||||
)
|
||||
|
||||
var castanagoliTable = crc32.MakeTable(crc32.Castagnoli)
|
||||
|
||||
func Crc32c(buffer []byte) (uint32, error) {
|
||||
crc := crc32.New(castanagoliTable)
|
||||
if len(buffer) <= 0 {
|
||||
return 0, errors.New("input buffer cannot be null")
|
||||
}
|
||||
crc.Write(buffer)
|
||||
return crc.Sum32(), nil
|
||||
}
|
Loading…
Reference in New Issue
Block a user