msvc2019-arm64.patch 533 B

123456789101112131415161718192021
  1. --- a/upb/hash/common.c 2025-06-02 14:39:32.082862245 +0800
  2. +++ b/upb/hash/common.c 2025-06-02 14:42:34.036621441 +0800
  3. @@ -43,8 +43,18 @@
  4. #elif defined(__GNUC__)
  5. #define UPB_FAST_POPCOUNT32(i) __builtin_popcount(i)
  6. #elif defined(_MSC_VER)
  7. +#if defined(_M_ARM64)
  8. +unsigned int UPB_FAST_POPCOUNT32(unsigned int x) {
  9. + unsigned int c = 0;
  10. + for(; x; c++) {
  11. + x &= x - 1;
  12. + }
  13. + return c;
  14. +}
  15. +#else
  16. #define UPB_FAST_POPCOUNT32(i) __popcnt(i)
  17. #endif
  18. +#endif
  19. UPB_INLINE int _upb_popcnt32(uint32_t i) {
  20. #ifdef UPB_FAST_POPCOUNT32