Skip to content

Conversation

@PaulusParssinen
Copy link
Contributor

Turns out this was unnecessary. https://godbolt.org/z/86jszKEY1

Copilot AI review requested due to automatic review settings December 7, 2025 21:03
@PaulusParssinen PaulusParssinen force-pushed the remove-unnecessary-unsafe-from-getgeohashcode branch from adc25e6 to 80a445a Compare December 7, 2025 21:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR simplifies the GetGeoHashCode method by removing unnecessary unsafe code patterns. The refactoring replaces MemoryMarshal.GetReference combined with Unsafe.Add pointer arithmetic with straightforward array indexing. According to the godbolt analysis linked in the PR description, the compiler generates equivalent assembly code for both approaches, making the unsafe approach unnecessary.

Key Changes

  • Replaced unsafe pointer-based character access with direct array indexing
  • Simplified variable naming (hashStatehash) for improved clarity
  • Removed unused System.Runtime.InteropServices import

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@badrishc
Copy link
Collaborator

badrishc commented Dec 8, 2025

Good find!

@badrishc badrishc merged commit 578e25a into microsoft:main Dec 9, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants