Program Listing for File dstring.h

Return to documentation for file (include/flamegpu/util/dstring.h)

#ifndef INCLUDE_FLAMEGPU_UTIL_DSTRING_H_
#define INCLUDE_FLAMEGPU_UTIL_DSTRING_H_

#include <cuda_runtime.h>

namespace flamegpu {
namespace util {
__device__ __forceinline__ int dstrcmp(const char *s1, const char *s2) {
    const unsigned char *p1 = (const unsigned char *)s1;
    const unsigned char *p2 = (const unsigned char *)s2;

    while (*p1 && *p1 == *p2) ++p1, ++p2;

    return (*p1 > *p2) - (*p2  > *p1);
}

}  // namespace util
}  // namespace flamegpu

#endif  // INCLUDE_FLAMEGPU_UTIL_DSTRING_H_