Skip to content

Commit

Permalink
Stop inconsistently using the TypedNum alias for TypedValue
Browse files Browse the repository at this point in the history
Summary: We have an alias for TypedValue called TypedNum, which is supposed to mean the TV contains an int or double (but this is by convention only, there is no enforcement or behavior change). This was only applied in a handful of places, and the ony ones left were tvSub and tvMul from tv-arith.{h,cpp}, a tiny fraction of the places where we have such TypedValues. At this point it's more confusing than helpful, so delete the alias and just use the TypedValue type.

Reviewed By: paulbiss

Differential Revision: D40093634

fbshipit-source-id: a7ec457f5f40dfe464ecd1ed54af4430ec426308
  • Loading branch information
alexeyt authored and facebook-github-bot committed Oct 5, 2022
1 parent 7219147 commit ffa90fe
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
4 changes: 2 additions & 2 deletions hphp/runtime/base/tv-arith.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,11 +388,11 @@ TypedValue tvAdd(TypedValue c1, TypedValue c2) {
return tvArith(Add(), c1, c2);
}

TypedNum tvSub(TypedValue c1, TypedValue c2) {
TypedValue tvSub(TypedValue c1, TypedValue c2) {
return tvArith(Sub(), c1, c2);
}

TypedNum tvMul(TypedValue c1, TypedValue c2) {
TypedValue tvMul(TypedValue c1, TypedValue c2) {
return tvArith(Mul(), c1, c2);
}

Expand Down
6 changes: 3 additions & 3 deletions hphp/runtime/base/tv-arith.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ TypedValue tvAdd(TypedValue, TypedValue);
*
* These arithmetic operators on any php value only return numbers.
*/
TypedNum tvSub(TypedValue, TypedValue);
TypedNum tvMul(TypedValue, TypedValue);
TypedValue tvSub(TypedValue, TypedValue);
TypedValue tvMul(TypedValue, TypedValue);

/*
* PHP operators / and %.
Expand All @@ -57,7 +57,7 @@ TypedValue tvMod(TypedValue, TypedValue);
/*
* PHP Operator **.
*
* Always returns a TypedNum.
* Always returns KindOfInt64 or KindOfDouble.
*/
TypedValue tvPow(TypedValue, TypedValue);

Expand Down
5 changes: 0 additions & 5 deletions hphp/runtime/base/typed-value.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,6 @@ struct TypedValueAux : TypedValue {
*/
constexpr size_t kTVSimdAlign = 0x10;

/*
* A TypedNum is a TypedValue that is either KindOfDouble or KindOfInt64.
*/
using TypedNum = TypedValue;

///////////////////////////////////////////////////////////////////////////////

/*
Expand Down

0 comments on commit ffa90fe

Please sign in to comment.