Skip to content

Commit

Permalink
Use folly::to_underlying in DtoaFlags operators
Browse files Browse the repository at this point in the history
Summary: Use `folly::to_underlying` in `DtoaFlags` operators.

Reviewed By: yfeldblum

Differential Revision: D60614039

fbshipit-source-id: d1eb869b2e07aa8b53e0d31a32baf4463eb24499
  • Loading branch information
skrueger authored and facebook-github-bot committed Aug 3, 2024
1 parent d1a2421 commit 6c6d925
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions folly/Conv.h
Original file line number Diff line number Diff line change
Expand Up @@ -731,15 +731,11 @@ enum class DtoaFlags {
};

constexpr DtoaFlags operator|(DtoaFlags a, DtoaFlags b) {
using IntType = typename std::underlying_type<DtoaFlags>::type;
return static_cast<DtoaFlags>(
static_cast<IntType>(a) | static_cast<IntType>(b));
return static_cast<DtoaFlags>(to_underlying(a) | to_underlying(b));
}

constexpr DtoaFlags operator&(DtoaFlags a, DtoaFlags b) {
using IntType = typename std::underlying_type<DtoaFlags>::type;
return static_cast<DtoaFlags>(
static_cast<IntType>(a) & static_cast<IntType>(b));
return static_cast<DtoaFlags>(to_underlying(a) & to_underlying(b));
}

namespace detail {
Expand Down

0 comments on commit 6c6d925

Please sign in to comment.