逆映射

发布于 2024-09-17 20:21:38 字数 155 浏览 1 评论 0原文

现在说:是的,这是作业。我不是在寻求答案,但我希望得到任何帮助来了解这个问题的总体方向。我现在已经为此工作了几个小时,但还没有取得任何实际进展。

可以实现具有明确定义的逆函数的函数来将 32 位整数映射到 64 位整数吗?从 32 位到 64 位整数的所有函数都有明确定义的逆吗?

Saying right now: Yes, this is homework. I'm not asking for an answer, but I would love any help into a general direction to look at this problem at. I've been working on it now for hours and have not made any real progress.

Can a function, with a well defined inverse, be implemented to map 32 bit integers to 64 bit integers. Do all functions from 32bit to 64bit integers have well defined inverses?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苯莒 2024-09-24 20:21:38

当然不是。

以恒等函数为例。所有 32 位值在 64 位值空间中都有一个标识(仅在顶部 32 位中使用 0,仅使用底部 32 位作为值)。但是,任何前 32 位不为 0 的 64 位值在 32 位值空间中不会有对应的值。

以上是外行的解释,作为家庭作业解决方案可能不够严格(按预期)。您最好阅读一下鸽子洞原则

Of course not.

Take the identity function for example. All 32-bit values have an identity in the 64-bit value space (just use 0 in the top 32 bits, using only the bottom 32 bits for the value). However, any 64-bit value where the top 32 bits is not 0, will not have a corresponding value in the 32-bit value space.

The above is a layman's explanation, and is probably not rigorous enough as a homework solution (as intended). You'd do well to read up on the pigeonhole principle.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文