Browse Source

fixes for 2.063; also fixed tag value typeids

remotes/georgeg/no_streams
lomereiter 8 years ago
parent
commit
37ed738d79
  1. 26
      bio/bam/tagvalue.d
  2. 6
      bio/bam/thirdparty/msgpack.d
  3. 14
      bio/core/base.d
  4. 2
      bio/core/tinymap.d
  5. 2
      bio/sam/header.d

26
bio/bam/tagvalue.d

@ -160,24 +160,24 @@ alias TypeTuple!(TypeId!(char, 0b001_00_1_00),
TypeId!(short, 0b010_1_0000),
TypeId!(int, 0b100_1_0000),
TypeId!(float, 0b100_0_1_000),
TypeId!(float, 0b100_01_000),
TypeId!(ubyte[], 0b001_000_01),
TypeId!(ushort[], 0b010_000_01),
TypeId!(uint[], 0b100_000_01),
TypeId!(byte[], 0b001_010_01),
TypeId!(short[], 0b010_010_01),
TypeId!(int[], 0b100_010_01),
TypeId!(byte[], 0b001_100_01),
TypeId!(short[], 0b010_100_01),
TypeId!(int[], 0b100_100_01),
TypeId!(float[], 0b100_00_1_01),
TypeId!(float[], 0b100_01_001),
TypeId!(string, 0b001_00_0_11),
TypeId!(string, 0b001_00_1_11),
TypeId!(string, 0b001_00_101),
TypeId!(string, 0b001_01_101),
TypeId!(typeof(null), 0b0000_0010))
TypeIdMap;
private immutable hexStringTag = 0b001_00_1_11;
private immutable hexStringTag = 0b001_01_101;
private template GetType(U) {
alias U.Type GetType;
@ -402,13 +402,13 @@ struct Value {
bool is_float() @property const { return _tag == GetTypeId!float; }
/// ubyte[]/byte[]/ushort[]/short[]/uint[]/int[]/float[]
bool is_numeric_array() @property const { return (_tag & 0b11) == 0b01; }
bool is_numeric_array() @property const { return (_tag & 0b111) == 0b001; }
/// ubyte[]/byte[]/ushort[]/short[]/uint[]/int[]
bool is_array_of_integers() @property const { return (_tag & 0b111) == 0b001; }
bool is_array_of_integers() @property const { return (_tag & 0b1111) == 0b0001; }
/// float[]
bool is_array_of_floats() @property const { return (_tag & 0b111) == 0b101; }
bool is_array_of_floats() @property const { return (_tag & 0b1111) == 0b1001; }
/// ubyte/byte/ushort/short/uint/int
bool is_integer() @property const { return (_tag & 0b1111) == 0; }
@ -420,10 +420,10 @@ struct Value {
bool is_signed() @property const { return (_tag & 0b11111) == 0b10000; }
/// 'Z' or 'H' tag
bool is_string() @property const { return (_tag & 0b11) == 0b11; }
bool is_string() @property const { return (_tag & 0b111) == 0b101; }
/// 'H' tag
bool is_hexadecimal_string() @property const { return (_tag & 0b111) == 0b111; }
bool is_hexadecimal_string() @property const { return (_tag & 0b1101) == 0b1101; }
/// Serializes value in MessagePack format
public void toMsgpack(Packer)(ref Packer packer) const {

6
bio/bam/thirdparty/msgpack.d

@ -3146,12 +3146,6 @@ unittest
assert(value.as!(int) == -20);
assert(other == -10L);
// enum
enum E : int { F = -20 }
E e = value.as!(E);
assert(e == E.F);
// floating point
value = Value(0.1e-10L);
other = Value(0.1e-20L);

14
bio/core/base.d

@ -35,7 +35,7 @@ mixin template CommonBaseOperations() {
struct Base {
mixin TinyMapInterface!16;
private immutable ubyte[256] _char2code = [
private enum ubyte[256] _char2code = [
15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
@ -78,9 +78,9 @@ struct Base {
// V 0111 (not T)
//
// N 1111 (aNy base)
private immutable _code2char = "=ACMGRSVTWYHKDBN";
private enum _code2char = "=ACMGRSVTWYHKDBN";
private immutable ubyte[16] _complement_table = [0x0, 0x8, 0x4, 0xC,
private enum ubyte[16] _complement_table = [0x0, 0x8, 0x4, 0xC,
0x2, 0xA, 0x6, 0xE,
0x1, 0x9, 0x5, 0xD,
0x3, 0xB, 0x7, 0xF];
@ -120,7 +120,7 @@ struct Base {
_code = _char2code[cast(ubyte)c];
}
private immutable ubyte[5] nt5_to_nt16 = [1, 2, 4, 8, 15];
private enum ubyte[5] nt5_to_nt16 = [1, 2, 4, 8, 15];
private static Base fromBase5(Base5 base) {
Base b = void;
b._code = nt5_to_nt16[base.internal_code];
@ -156,7 +156,7 @@ alias Base Base16;
struct Base5 {
mixin TinyMapInterface!5;
private immutable ubyte[256] _char2code = [
private enum ubyte[256] _char2code = [
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
@ -178,8 +178,8 @@ struct Base5 {
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
];
private immutable _code2char = "ACGTN";
private immutable ubyte[16] nt16_to_nt5 = [4, 0, 1, 4, 2, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4];
private enum _code2char = "ACGTN";
private enum ubyte[16] nt16_to_nt5 = [4, 0, 1, 4, 2, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4];
mixin CommonBaseOperations;

2
bio/core/tinymap.d

@ -293,7 +293,7 @@ unittest {
mixin template TinyMapInterface(uint N, T=ubyte) if (isUnsigned!T) {
private T _code;
immutable ValueSetSize = N;
enum ValueSetSize = N;
static assert(N <= 2 ^^ (T.sizeof * 8));
static typeof(this) fromInternalCode(T code) {

2
bio/sam/header.d

@ -439,7 +439,7 @@ alias HeaderLineDictionary!PgLine PgLineDictionary;
class SamHeader {
///
immutable DEFAULT_FORMAT_VERSION = "1.3";
enum DEFAULT_FORMAT_VERSION = "1.3";
/// Construct empty SAM header
this() {

Loading…
Cancel
Save