• R/O
  • SSH
  • HTTPS

eirrepo: Commit


Commit MetaInfo

Revision104 (tree)
Time2018-05-22 21:33:21
Authorquiret

Log Message

- added stream pointer helper

Change Summary

Incremental Difference

--- common/sdk/MemoryUtils.stream.h (revision 103)
+++ common/sdk/MemoryUtils.stream.h (revision 104)
@@ -172,7 +172,20 @@
172172
173173 return readable;
174174 }
175-};
175+};
176+
177+// Comparison helper for stream ptr with size integer.
178+AINLINE bool stream_ptr_less( const fsOffsetNumber_t& ptr, const size_t& val )
179+{
180+ if ( ptr < 0 )
181+ {
182+ return true;
183+ }
184+
185+ std::make_unsigned <fsOffsetNumber_t>::type ptr_unsigned = (std::make_unsigned <fsOffsetNumber_t>::type)ptr;
186+
187+ return ( ptr_unsigned < val );
188+}
176189
177190 // We need a generic memory-aware bounded buffer device.
178191 // Most importantly this is just a helper-class based on the BoundedBufferOperations.
@@ -385,7 +398,7 @@
385398 else
386399 {
387400 void *newPtr = realloc( bufferPtrOut, reqSize );
388-
401+
389402 if ( newPtr )
390403 {
391404 bufferPtrOut = newPtr;
@@ -400,4 +413,4 @@
400413 using basicMemoryBufferStream = memoryBufferStream <numberType, basicMemStreamAllocMan <numberType>>;
401414 };
402415
403-#endif //_MEMORY_UTILITIES_STREAM_
\ No newline at end of file
416+#endif //_MEMORY_UTILITIES_STREAM_
Show on old repository browser