We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
defmodule Unsigned do use Protobuf, """ message Negative { required uint32 issue = 1; } end """
iex> Unsigned.Negative.new(issue: -420) |> Unsigned.Negative.encode |> Unsigned.Negative.decode %Unsigned.Negative{issue: 92} iex> Unsigned.Negative.new(issue: -2) |> Unsigned.Negative.encode |> Unsigned.Negative.decode ** (FunctionClauseError) no function clause matching in :gpb.de_vi/4 The following arguments were given to :gpb.de_vi/4: # 1 "" # 2 7 # 3 126 # 4 32 (gpb) src/gpb.erl:856: :gpb.de_vi/4 (gpb) src/gpb.erl:357: :gpb.decode_type/3 (gpb) src/gpb.erl:244: :gpb.decode_field/4 (exprotobuf) lib/exprotobuf/decoder.ex:22: Protobuf.Decoder.decode/2
mafintosh/protocol-buffers#62
The text was updated successfully, but these errors were encountered:
An unsigned integer is only supposed to hold positive values. You should be using int32 instead if you need to encode negative values.
int32
Sorry, something went wrong.
Oh ok. I thought it would turn a -40 into 40 at encoding time. My bad then.
-40
40
No branches or pull requests
Set up for replication
Replicate issue
Related issues (maybe)
mafintosh/protocol-buffers#62
The text was updated successfully, but these errors were encountered: