Is there a better way to reverse an array of bytes in memory?

后端 未结 5 2045
一向
一向 2021-01-02 00:19
typedef unsigned char Byte;

...

void ReverseBytes( void *start, int size )
{
    Byte *buffer = (Byte *)(start);

    for( int i = 0; i < size / 2; i++ ) {
             


        
5条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-02 01:17

    If you need to reverse there is a chance that you can improve your algorithms and just use reverse iterators.

提交回复
热议问题