Add default value to first argument of sub_array()
authorBehdad Esfahbod <behdad@behdad.org>
Thu, 6 Dec 2018 18:26:32 +0000 (10:26 -0800)
committerBehdad Esfahbod <behdad@behdad.org>
Thu, 6 Dec 2018 18:26:32 +0000 (10:26 -0800)
src/hb-dsalgs.hh

index 1956bb9..653dd6a 100644 (file)
@@ -588,8 +588,11 @@ struct hb_array_t
 
   inline unsigned int get_size (void) const { return len * sizeof (Type); }
 
-  inline hb_array_t<Type> sub_array (unsigned int start_offset, unsigned int *seg_count = nullptr /* IN/OUT */) const
+  inline hb_array_t<Type> sub_array (unsigned int start_offset = 0, unsigned int *seg_count = nullptr /* IN/OUT */) const
   {
+    if (!start_offset && !seg_count)
+      return *this;
+
     unsigned int count = len;
     if (unlikely (start_offset > count))
       count = 0;