bytereader: add inline version of gst_byte_reader_skip

This commit is contained in:
Tim-Philipp Müller 2009-10-05 00:11:20 +01:00
parent 28fcb132e5
commit d600ce0a29
2 changed files with 13 additions and 6 deletions

View file

@ -222,12 +222,7 @@ gst_byte_reader_skip (GstByteReader * reader, guint nbytes)
{ {
g_return_val_if_fail (reader != NULL, FALSE); g_return_val_if_fail (reader != NULL, FALSE);
if (gst_byte_reader_get_remaining (reader) < nbytes) return _gst_byte_reader_skip_inline (reader, nbytes);
return FALSE;
reader->byte += nbytes;
return TRUE;
} }
/** /**

View file

@ -435,6 +435,16 @@ _gst_byte_reader_peek_data_inline (GstByteReader * reader, guint size, const gui
return TRUE; return TRUE;
} }
static inline gboolean
_gst_byte_reader_skip_inline (GstByteReader * reader, guint nbytes)
{
if (G_UNLIKELY (_gst_byte_reader_get_remaining_inline (reader) < nbytes))
return FALSE;
reader->byte += nbytes;
return TRUE;
}
#ifndef GST_BYTE_READER_DISABLE_INLINES #ifndef GST_BYTE_READER_DISABLE_INLINES
#define gst_byte_reader_dup_data(reader,size,val) \ #define gst_byte_reader_dup_data(reader,size,val) \
@ -443,6 +453,8 @@ _gst_byte_reader_peek_data_inline (GstByteReader * reader, guint size, const gui
G_LIKELY(_gst_byte_reader_get_data_inline(reader,size,val)) G_LIKELY(_gst_byte_reader_get_data_inline(reader,size,val))
#define gst_byte_reader_peek_data(reader,size,val) \ #define gst_byte_reader_peek_data(reader,size,val) \
G_LIKELY(_gst_byte_reader_peek_data_inline(reader,size,val)) G_LIKELY(_gst_byte_reader_peek_data_inline(reader,size,val))
#define gst_byte_reader_skip(reader,nbytes) \
G_LIKELY(_gst_byte_reader_skip_inline(reader,nbytes))
#endif /* GST_BYTE_READER_DISABLE_INLINES */ #endif /* GST_BYTE_READER_DISABLE_INLINES */