mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkWriter: runtime resizing comment
This commit is contained in:
parent
2ea328750c
commit
c3ac08203a
@ -38,6 +38,9 @@ public void Reset()
|
||||
Position = 0;
|
||||
}
|
||||
|
||||
// NOTE that our runtime resizing comes at no extra cost because:
|
||||
// 1. 'has space' checks are necessary even for fixed sized writers.
|
||||
// 2. all writers will eventually be large enough to stop resizing.
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
void EnsureCapacity(int value)
|
||||
{
|
||||
@ -111,6 +114,9 @@ internal unsafe void WriteBlittable<T>(T value)
|
||||
int size = sizeof(T);
|
||||
|
||||
// ensure capacity
|
||||
// NOTE that our runtime resizing comes at no extra cost because:
|
||||
// 1. 'has space' checks are necessary even for fixed sized writers.
|
||||
// 2. all writers will eventually be large enough to stop resizing.
|
||||
EnsureCapacity(Position + size);
|
||||
|
||||
// write blittable
|
||||
|
Loading…
Reference in New Issue
Block a user