Skip to content

Conversation

Copy link

Copilot AI commented Dec 19, 2025

TypeSymbol and FileSymbol represent binary encodings, not signed integers. Using int64 required unnecessary conversions and could produce unexpected behavior with large values.

Changes

  • Struct definitions: Changed TypeSymbol and FileSymbol fields from int64 to uint64 in FrameContent, FileMetadata, and ScannedFile structs
  • Binary encoding/decoding: Removed int64/uint64 conversions in UnmarshalBinary and EncodeTo methods
  • Scanner: Updated to use strconv.ParseUint and proper uint64 array indexing for chunk numbers
  • Extraction: Removed unnecessary type conversions when formatting symbols
// Before: Required conversion and could mishandle large values
m.FrameContents[i].TypeSymbol = int64(binary.LittleEndian.Uint64(data[offset:]))
fileType := strconv.FormatUint(uint64(fc.TypeSymbol), 16)

// After: Direct handling as uint64
m.FrameContents[i].TypeSymbol = binary.LittleEndian.Uint64(data[offset:])
fileType := strconv.FormatUint(fc.TypeSymbol, 16)

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: thesprockee <962164+thesprockee@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor and optimize archive and manifest handling Convert TypeSymbol and FileSymbol from int64 to uint64 Dec 19, 2025
Copilot AI requested a review from thesprockee December 19, 2025 23:39
@thesprockee thesprockee marked this pull request as ready for review December 20, 2025 01:07
Copilot AI review requested due to automatic review settings December 20, 2025 01:07
Copy link

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 converts TypeSymbol and FileSymbol fields from int64 to uint64 throughout the codebase, improving type correctness since these fields represent binary encodings rather than signed integers. The change eliminates unnecessary type conversions and prevents potential issues with large unsigned values being interpreted as negative numbers.

Key changes:

  • Updated struct field types for TypeSymbol and FileSymbol to uint64 in FrameContent, FileMetadata, and ScannedFile
  • Simplified binary encoding/decoding by removing int64/uint64 conversions in marshaling operations
  • Updated scanner parsing logic to use strconv.ParseUint instead of strconv.ParseInt

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

File Description
pkg/manifest/scanner.go Changed ScannedFile fields to uint64, updated parsing to use strconv.ParseUint, and adjusted array growth condition to use uint64 comparisons
pkg/manifest/package.go Removed unnecessary uint64 conversions when formatting symbols for file extraction
pkg/manifest/manifest.go Updated FrameContent and FileMetadata struct definitions to use uint64, and removed conversions in UnmarshalBinary and EncodeTo methods
pkg/manifest/benchmark_test.go Updated test data initialization to use uint64 literals for consistency with new field types

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

@thesprockee thesprockee merged commit bb33f9a into enhance/performance Dec 20, 2025
6 checks passed
@thesprockee thesprockee deleted the copilot/sub-pr-2 branch December 20, 2025 01:22
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.

2 participants