View Issue Details

IDProjectCategoryView StatusLast Update
0034117FPCPackagespublic2018-08-12 18:46
ReporterCudaText manAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version3.1.1Product Build 
Target Version3.2.0Fixed in Version3.1.1 
Summary0034117: RegExpr: optimize HexDig
Description
 function HexDig (ch : REChar) : PtrInt;
  begin
   Result := 0;
   if (ch >= 'a') and (ch <= 'f')
    then ch := REChar (ord (ch) - (ord ('a') - ord ('A')));
   if (ch < '0') or (ch > 'F') or ((ch > '9') and (ch < 'A')) then begin
     Error (reeBadHexDigit);
     EXIT;
    end;
   Result := ord (ch) - ord ('0');
   if ch >= 'A'
    then Result := Result - (ord ('A') - ord ('9') - 1);
  end;

  
this is very poor style, better rewrite with "case ch of" with
4 cases: '0'..'9' / 'a'..'f' / 'A'..'F' / else.
TagsNo tags attached.
Fixed in Revision39610
FPCOldBugId
FPCTarget
Attached Files

Activities

Michael Van Canneyt

2018-08-12 11:28

administrator   ~0109991

Changed, thanks for suggesting!

Issue History

Date Modified Username Field Change
2018-08-11 20:58 CudaText man New Issue
2018-08-12 01:29 Michael Van Canneyt Assigned To => Michael Van Canneyt
2018-08-12 01:29 Michael Van Canneyt Status new => assigned
2018-08-12 11:28 Michael Van Canneyt Fixed in Revision => 39610
2018-08-12 11:28 Michael Van Canneyt Note Added: 0109991
2018-08-12 11:28 Michael Van Canneyt Status assigned => resolved
2018-08-12 11:28 Michael Van Canneyt Fixed in Version => 3.1.1
2018-08-12 11:28 Michael Van Canneyt Resolution open => fixed
2018-08-12 11:28 Michael Van Canneyt Target Version => 3.2.0
2018-08-12 18:46 CudaText man Status resolved => closed