Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 463F810F11 for ; Wed, 26 Feb 2014 12:11:27 +0000 (UTC) Received: (qmail 73202 invoked by uid 500); 26 Feb 2014 12:11:24 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 73172 invoked by uid 500); 26 Feb 2014 12:11:22 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 73157 invoked by uid 99); 26 Feb 2014 12:11:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Feb 2014 12:11:21 +0000 X-ASF-Spam-Status: No, hits=-6.5 required=5.0 tests=ENV_AND_HDR_SPF_MATCH,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,USER_IN_DEF_SPF_WL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of michael.laing@nytimes.com designates 209.85.216.174 as permitted sender) Received: from [209.85.216.174] (HELO mail-qc0-f174.google.com) (209.85.216.174) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Feb 2014 12:11:14 +0000 Received: by mail-qc0-f174.google.com with SMTP id x13so469904qcv.19 for ; Wed, 26 Feb 2014 04:10:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=heRbZANXwe9i0gqrx25ZDwFrAdd1pw9a3MnTNkjUEMw=; b=e8wrFVpifBKyAvgkVYHlQjJxgXFBdD/kWmmic6fhMZrNApA23d6QnE7NYjvPLXW4o2 N5PZINNA41Gk0yQER9KMxUn/sT1x3G5qgz3m37npgVy3WKT/uo4IgI6mxLCHJnuROiip dDxDvHwY+LjwgoKFi6S2v7RxwdP3sybCIHkfMwHbRoLq7Rx2T6kDWyM82AmVanWi2oNt t6OnE4PRAkKjGT9BFCqOeIzyFoGfCy4Zlxku6cLp9Skjm9esWM2g/zWKiLCvpWtzqX48 xj0L0wWCKf/OmIDIGH0MK90G54CHV+sPcptMGCBLatoLnX+KjyWCC6BsEJui6TjKCUu6 RcGA== X-Gm-Message-State: ALoCoQlGSIaqWRx0meEs7G6l1gxHqxK7TizmZCXatbYGJDEPOyRnZTzXwguPp+RKV3rrhmHjJ7DW MIME-Version: 1.0 X-Received: by 10.224.119.147 with SMTP id z19mr7468987qaq.20.1393416652763; Wed, 26 Feb 2014 04:10:52 -0800 (PST) Received: by 10.140.27.76 with HTTP; Wed, 26 Feb 2014 04:10:52 -0800 (PST) In-Reply-To: <49E00BE0-2027-434C-98E2-1AEC0D182868@gmail.com> References: <530D18AF.5040507@barracuda.com> <49E00BE0-2027-434C-98E2-1AEC0D182868@gmail.com> Date: Wed, 26 Feb 2014 07:10:52 -0500 Message-ID: Subject: Re: CQL decimal encoding From: "Laing, Michael" To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=047d7bacb7109cea7804f34e188b X-Virus-Checked: Checked by ClamAV on apache.org --047d7bacb7109cea7804f34e188b Content-Type: text/plain; charset=UTF-8 go uses 'zig-zag' encoding, perhaps that is the difference? On Wed, Feb 26, 2014 at 6:52 AM, Peter Lin wrote: > > You may need to bit shift if that is the case > > Sent from my iPhone > > > On Feb 26, 2014, at 2:53 AM, Ben Hood <0x6e6562@gmail.com> wrote: > > > > Hey Colin, > > > >> On Tue, Feb 25, 2014 at 10:26 PM, Colin Blower > wrote: > >> It looks like you are trying to implement the Decimal type. You might > want > >> to start with implementing the Integer type. The Decimal type follows > pretty > >> easily from the Integer type. > >> > >> For example: > >> i = unmarchalInteger(data[4:]) > >> s = decInt(data[0:4]) > >> out = inf.newDec(i, s) > > > > Thanks for the suggestion. > > > > This is pretty much what I've got already. I think the issue might be > > to do with the way that big.Int doesn't appear to use two's complement > > to encode the varint. Maybe what is happening is that the encoding is > > isomorphic across say Java, .NET, Python and Ruby, but that the > > big.Int library in Go is not encoding in the same way. > > > > Cheers, > > > > Ben > --047d7bacb7109cea7804f34e188b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
go uses 'zig-zag' encoding, perhaps that is the di= fference?


On Wed, Feb 26, 2014 at 6:52 AM, Peter Lin <woolfel@gmail.com> wrote:

You may need to bit shift if that is the case

Sent from my iPhone

> On Feb 26, 2014, at 2:53 AM, Ben Hood <0x6e6562@gmail.com> wrote:
>
> Hey Colin,
>
>> On Tue, Feb 25, 2014 at 10:26 PM, Colin Blower <cblower@barracuda.com> wrote:
>> It looks like you are trying to implement the Decimal type. You mi= ght want
>> to start with implementing the Integer type. The Decimal type foll= ows pretty
>> easily from the Integer type.
>>
>> For example:
>> i =3D unmarchalInteger(data[4:])
>> s =3D decInt(data[0:4])
>> out =3D inf.newDec(i, s)
>
> Thanks for the suggestion.
>
> This is pretty much what I've got already. I think the issue might= be
> to do with the way that big.Int doesn't appear to use two's co= mplement
> to encode the varint. Maybe what is happening is that the encoding is<= br> > isomorphic across say Java, .NET, Python and Ruby, but that the
> big.Int library in Go is not encoding in the same way.
>
> Cheers,
>
> Ben

--047d7bacb7109cea7804f34e188b--