Skip to content

Commit

Permalink
Merge pull request #222 from observerly/feature/metadata/DataType/Byt…
Browse files Browse the repository at this point in the history
…eSize

feat: add (d DataType) ByteSize() to metadata module in @observerly/iris
  • Loading branch information
michealroberts authored Oct 17, 2024
2 parents 6c7d20a + 1eb94ef commit 10a4cf3
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 10a4cf3

Please sign in to comment.