Skip to content

Make serializing integral types nothrow #41

New issue

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/google/protobuf/encoding.d
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ if (isIntegral!T)
}
}

unittest
nothrow unittest
{
import std.array : array;

18 changes: 9 additions & 9 deletions src/google/protobuf/internal.d
100644 → 100755
Original file line number Diff line number Diff line change
@@ -10,9 +10,9 @@ struct Varint
private ubyte index;
private ubyte _length;

this(long value)
this(long value) nothrow
out { assert(_length > 0); }
body
do
{
size_t encodingLength(long value)
{
@@ -39,13 +39,13 @@ struct Varint
this._length = cast(ubyte) encodingLength(value);
}

@property bool empty() const { return index >= _length; }
@property ubyte front() const { return opIndex(index); }
void popFront() { ++index; }
@property bool empty() nothrow const { return index >= _length; }
@property ubyte front() nothrow const { return opIndex(index); }
void popFront() nothrow { ++index; }

ubyte opIndex(size_t index) const
ubyte opIndex(size_t index) nothrow const
in { assert(index < _length); }
body
do
{
auto result = value >>> (index * 7);

@@ -55,9 +55,9 @@ struct Varint
return result & 0x7F;
}

@property size_t length() const
@property size_t length() nothrow const
in { assert(index <= _length); }
body
do
{
return _length - index;
}