Implement crc32c for Darwin, update documentation

This commit is contained in:
Harshavardhana 2015-01-23 19:33:37 -08:00
parent 727a8669fa
commit 01d15ca3b2
6 changed files with 38 additions and 11 deletions

View file

@ -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:

View file

@ -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

View file

@ -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

View 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
}