Skip to content

Commit

Permalink
feat: add (d DataType) ByteSize() to metadata module in @observerly/iris
Browse files Browse the repository at this point in the history
feat: add (d DataType) ByteSize() to metadata module in @observerly/iris
  • Loading branch information
michealroberts committed Oct 17, 2024
1 parent 6c7d20a commit 1eb94ef
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions pkg/ifd/datatype.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,43 @@ const (
)

/*****************************************************************************************************************/

func (d DataType) ByteSize() int {
switch d {
case DataTypeByte:
return 1
case DataTypeASCII:
return 1
case DataTypeShort:
return 2
case DataTypeLong:
return 4
case DataTypeRational:
return 8
case DataTypeSByte:
return 1
case DataTypeUndefined:
return 1
case DataTypeSShort:
return 2
case DataTypeSLong:
return 4
case DataTypeSRational:
return 8
case DataTypeFloat:
return 4
case DataTypeDouble:
return 8
case DataTypeIFD:
return 4 // LONG
case DataTypeLong8:
return 8
case DataTypeSLong8:
return 8
case DataTypeIFD8:
return 8 // LONG8
}
return 0
}

/*****************************************************************************************************************/

0 comments on commit 1eb94ef

Please sign in to comment.