This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR46590


On Fri, Jan 17, 2014 at 12:32:34PM +0100, Richard Biener wrote:
> ! /* Search the contents of the sorted vector with a binary search.
> !    CMP is the comparison function to pass to bsearch.  */

Can you please sed -i -e s/__//g in the whole method?
I mean, this isn't in libstdc++ or glibc header, so there is no point
in obfuscating the names, and the __ prefixed names are even reserved
for implementation, which we are not at least in stage1 built compiler.

> ! template<typename T, typename A>
> ! inline T *
> ! vec<T, A, vl_embed>::bsearch (const void *__key,
> ! 			      int (*__compar) (const void *, const void *))
> ! {
> !   const void *__base = this->address ();
> !   size_t __nmemb = this->length ();
> !   size_t __size = sizeof (T);
> !   /* The following is a copy of glibc stdlib-bsearch.h.  */
> !   size_t __l, __u, __idx;
> !   const void *__p;
> !   int __comparison;
> ! 
> !   __l = 0;
> !   __u = __nmemb;
> !   while (__l < __u)
> !     {
> !       __idx = (__l + __u) / 2;
> !       __p = (const void *) (((const char *) __base) + (__idx * __size));
> !       __comparison = (*__compar) (__key, __p);
> !       if (__comparison < 0)
> ! 	__u = __idx;
> !       else if (__comparison > 0)
> ! 	__l = __idx + 1;
> !       else
> ! 	return (T *)const_cast<void *>(__p);
> !     }
> ! 
> !   return NULL;
>   }

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]