Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small optim here? #7

Open
Alexey-T opened this issue Nov 26, 2022 · 1 comment
Open

small optim here? #7

Alexey-T opened this issue Nov 26, 2022 · 1 comment

Comments

@Alexey-T
Copy link

Alexey-T commented Nov 26, 2022

function THasherList.FindClass(Name: String; out AClass: THasherClass): Boolean;
var Index: Integer;
begin
  Name := LowerCase(Name);
  Index := FList.IndexOf(Name);

FList.IndexOf(LowerCase(Name)) and make Name the const-param.

@PascalVault
Copy link
Owner

While this is a nice idea for how the code works now I have a plan to extend functionality of FindClass() if people find it useful.

The plan is to find THasherClasses even when "Name" is not an exact match - has unnecessary spaces, hyphens or slashes. So for example if the registered name is "CRC-16 KERMITT" then calling FindClass(" CRC16/KERMITT ") would also find this class.

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

No branches or pull requests

2 participants