Skip to content

Conversation

@xuhdev
Copy link
Collaborator

@xuhdev xuhdev commented Mar 24, 2020

Stack from ghstack:

Currently lshift_kernel uses a hacky wrapper that wraps all integer
types. This is unnecessary because we have std::make_unsigned_t

Differential Revision: D20824641

Currently lshift_kernel uses a hacky wrapper that wraps all integer
types. This is unnecessary because we have std::make_unsigned_t

[ghstack-poisoned]
@xuhdev xuhdev requested review from XiaobingSuper, zasdfgbnm and zou3519 and removed request for XiaobingSuper and zasdfgbnm March 24, 2020 21:35
@dr-ci
Copy link

dr-ci bot commented Mar 24, 2020

💊 CircleCI build failures summary and remediations

As of commit dc94be3 (more details on the Dr. CI page):


💚 💚 Looks good so far! There are no CircleCI failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker.

See how this bot performed.

This comment has been revised 8 times.

@albanD albanD added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Mar 25, 2020
Currently lshift_kernel uses a hacky wrapper that wraps all integer
types. This is unnecessary because we have std::make_unsigned_t

[ghstack-poisoned]
Copy link
Contributor

@zou3519 zou3519 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

}

static inline int64_t lshift_wrapper(int64_t a, int64_t b) {
return ((uint64_t)a) << b;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just out of curiosity, why do we have to make the left hand side unsigned before performing the shift?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably because shifting on signed integers in C++ is implementation defined. See https://stackoverflow.com/a/4009954/1150462 for an explanation and reference.

Currently lshift_kernel uses a hacky wrapper that wraps all integer
types. This is unnecessary because we have std::make_unsigned_t

[ghstack-poisoned]
@xuhdev
Copy link
Collaborator Author

xuhdev commented Apr 14, 2020

Weird, this has actually been merged in beac3f2 . Manually closing now.

@xuhdev xuhdev closed this Apr 14, 2020
@facebook-github-bot facebook-github-bot deleted the gh/xuhdev/66/head branch May 14, 2020 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open source triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants