{"action":"created","issue":{"url":"https://api.github.com/repos/twittner/cbor-codec/issues/7","labels_url":"https://api.github.com/repos/twittner/cbor-codec/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/twittner/cbor-codec/issues/7/comments","events_url":"https://api.github.com/repos/twittner/cbor-codec/issues/7/events","html_url":"https://github.com/twittner/cbor-codec/issues/7","id":101122502,"number":7,"title":"Encoding/Decoding i8/i16/i32/i64 types","user":{"login":"tailhook","id":321799,"avatar_url":"https://avatars.githubusercontent.com/u/321799?v=3","gravatar_id":"","url":"https://api.github.com/users/tailhook","html_url":"https://github.com/tailhook","followers_url":"https://api.github.com/users/tailhook/followers","following_url":"https://api.github.com/users/tailhook/following{/other_user}","gists_url":"https://api.github.com/users/tailhook/gists{/gist_id}","starred_url":"https://api.github.com/users/tailhook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tailhook/subscriptions","organizations_url":"https://api.github.com/users/tailhook/orgs","repos_url":"https://api.github.com/users/tailhook/repos","events_url":"https://api.github.com/users/tailhook/events{/privacy}","received_events_url":"https://api.github.com/users/tailhook/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-14T23:41:23Z","updated_at":"2015-08-16T21:37:08Z","closed_at":null,"body":"I've assumed that `i32` and similar methods decode *unsigned* value. But in current implementation they decode *negative* value only. I know that negative values have different opcode in CBOR protocol, but I still think API is wrong.\r\n\r\nWhen I'm reading a value I don't know is it negative or not, just like I don't know if it 8 or 16 or 32 bits. So I believe it's just a bug, and that both encoding and decoding of i32 should work with positive values. Right?"},"comment":{"url":"https://api.github.com/repos/twittner/cbor-codec/issues/comments/131629479","html_url":"https://github.com/twittner/cbor-codec/issues/7#issuecomment-131629479","issue_url":"https://api.github.com/repos/twittner/cbor-codec/issues/7","id":131629479,"user":{"login":"twittner","id":132165,"avatar_url":"https://avatars.githubusercontent.com/u/132165?v=3","gravatar_id":"","url":"https://api.github.com/users/twittner","html_url":"https://github.com/twittner","followers_url":"https://api.github.com/users/twittner/followers","following_url":"https://api.github.com/users/twittner/following{/other_user}","gists_url":"https://api.github.com/users/twittner/gists{/gist_id}","starred_url":"https://api.github.com/users/twittner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twittner/subscriptions","organizations_url":"https://api.github.com/users/twittner/orgs","repos_url":"https://api.github.com/users/twittner/repos","events_url":"https://api.github.com/users/twittner/events{/privacy}","received_events_url":"https://api.github.com/users/twittner/received_events","type":"User","site_admin":false},"created_at":"2015-08-16T21:37:08Z","updated_at":"2015-08-16T21:37:08Z","body":"Major type 1 (\"negative integer\") is somewhat challenging as the value range may very well exceed the ones of `i8` et al. I agree tough, that all values within `i8::MIN` and `i8::MAX` should be supported (likewise for `i16`, `i32`, and `i64`). A further complication involves generic encoding/decoding using the `Value` AST. A map which starts out with a key `Key::I16(200)` may be parsed differently, thus ending up maybe with a `Key::U8(200)` (although unsigned key types have the same problem already).\r\n\r\nTo cut it short, the [`num`](https://github.com/twittner/cbor-codec/compare/num) branch supports mixed integers and removes the generic decoder and its supporting infrastructure (`Value` etc). `GenericDecoder` was originially motivated by the need to decode heterogenous maps and arrays which is now possible directly and to skip over unknown values which is also possible now using the direct decoder. Would this be okay for you?"}}