Implement crc32c for Darwin, update documentation

master
Harshavardhana 10 years ago
parent 727a8669fa
commit 01d15ca3b2
  1. 5
      BUILDDEPS.md
  2. 7
      Makefile
  3. 2
      README.md
  4. 35
      pkg/utils/checksum/crc32c/crc32c_darwin.go
  5. 0
      pkg/utils/checksum/crc32c/crc32c_linux.go
  6. 0
      pkg/utils/checksum/crc32c/crc32c_linux_amd64.S

@ -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)" $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
``` ```
##### Install Git and GCC ##### Install Git
```sh ```sh
$ brew install git gcc $ brew install git
``` ```
##### Install YASM ##### Install YASM
@ -64,7 +64,6 @@ $ brew install yasm
``` ```
##### Install Go 1.4+ ##### Install Go 1.4+
On MacOSX ``brew.sh`` is the best way to install golang On MacOSX ``brew.sh`` is the best way to install golang
For example: For example:

@ -1,7 +1,6 @@
#GOPATH := $(CURDIR)/tmp/gopath #GOPATH := $(CURDIR)/tmp/gopath
MAKE_OPTIONS := -s MAKE_OPTIONS := -s
ARCH := $(shell uname -s) ARCH := $(shell uname -s)
GCCVERSIONGTEQ4 := $(shell expr `gcc -dumpversion | cut -f1 -d.` \>= 4)
all: getdeps install 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/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/sha256
@godep go test -race -coverprofile=cover.out github.com/minio-io/minio/pkg/utils/crypto/sha512 @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 @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: #build-os:
# @godep go test -race -coverprofile=cover.out github.com/minio-io/minio/pkg/os/scsi # @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 | | Linux | Yes |
| Windows | Not yet | | Windows | Not yet |
| Mac OSX | Yes(with GCC) | | Mac OSX | Yes |
### Supported architectures ### Supported architectures

@ -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…
Cancel
Save