docs/vendor.js
function bloomFindPossibleInjector(startInjector, bloomBit, flags) {
    // Create a mask that targets the specific bit associated with the directive we're looking for.
    // JS bit operations are 32 bits, so this will be a number between 2^0 and 2^31, corresponding
    // to bit positions 0 - 31 in a 32 bit integer.
    var mask = 1 << bloomBit;
    // Traverse up the injector tree until we find a potential match or until we know there *isn't* a
    // match.
    var injector = flags & 4 /* SkipSelf */ ? startInjector.parent : startInjector;
    while (injector) {
        // Our bloom filter size is 256 bits, which is eight 32-bit bloom filter buckets:
        // bf0 = [0 - 31], bf1 = [32 - 63], bf2 = [64 - 95], bf3 = [96 - 127], etc.
        // Get the bloom filter value from the appropriate bucket based on the directive's bloomBit.
        var value = void 0;
        if (bloomBit < 128) {
            value = bloomBit < 64 ? (bloomBit < 32 ? injector.bf0 : injector.bf1) :
                (bloomBit < 96 ? injector.bf2 : injector.bf3);
        }
        else {
            value = bloomBit < 192 ? (bloomBit < 160 ? injector.bf4 : injector.bf5) :
                (bloomBit < 224 ? injector.bf6 : injector.bf7);
        }
        // If the bloom filter value has the bit corresponding to the directive's bloomBit flipped on,
        // this injector is a potential match.
        if ((value & mask) === mask) {
            return injector;
        }
        else if (flags & 2 /* Self */ || flags & 1 /* Host */ && !sameHostView(injector)) {
            return null;
        }
        // If the current injector does not have the directive, check the bloom filters for the ancestor
        // injectors (cbf0 - cbf7). These filters capture *all* ancestor injectors.
        if (bloomBit < 128) {
            value = bloomBit < 64 ? (bloomBit < 32 ? injector.cbf0 : injector.cbf1) :
                (bloomBit < 96 ? injector.cbf2 : injector.cbf3);
        }
        else {
            value = bloomBit < 192 ? (bloomBit < 160 ? injector.cbf4 : injector.cbf5) :
                (bloomBit < 224 ? injector.cbf6 : injector.cbf7);
        }
        // If the ancestor bloom filter value has the bit corresponding to the directive, traverse up to
        // find the specific injector. If the ancestor bloom filter does not have the bit, we can abort.
        injector = (value & mask) ? injector.parent : null;
    }
    return null;
}
function bloomFindPossibleInjector(startInjector, bloomBit, flags) {
    // Create a mask that targets the specific bit associated with the directive we're looking for.
    // JS bit operations are 32 bits, so this will be a number between 2^0 and 2^31, corresponding
    // to bit positions 0 - 31 in a 32 bit integer.
    var mask = 1 << bloomBit;
    // Traverse up the injector tree until we find a potential match or until we know there *isn't* a
    // match.
    var injector = flags & 4 /* SkipSelf */ ? startInjector.parent : startInjector;
    while (injector) {
        // Our bloom filter size is 256 bits, which is eight 32-bit bloom filter buckets:
        // bf0 = [0 - 31], bf1 = [32 - 63], bf2 = [64 - 95], bf3 = [96 - 127], etc.
        // Get the bloom filter value from the appropriate bucket based on the directive's bloomBit.
        var value = void 0;
        if (bloomBit < 128) {
            value = bloomBit < 64 ? (bloomBit < 32 ? injector.bf0 : injector.bf1) :
                (bloomBit < 96 ? injector.bf2 : injector.bf3);
        }
        else {
            value = bloomBit < 192 ? (bloomBit < 160 ? injector.bf4 : injector.bf5) :
                (bloomBit < 224 ? injector.bf6 : injector.bf7);
        }
        // If the bloom filter value has the bit corresponding to the directive's bloomBit flipped on,
        // this injector is a potential match.
        if ((value & mask) === mask) {
            return injector;
        }
        else if (flags & 2 /* Self */ || flags & 1 /* Host */ && !sameHostView(injector)) {
            return null;
        }
        // If the current injector does not have the directive, check the bloom filters for the ancestor
        // injectors (cbf0 - cbf7). These filters capture *all* ancestor injectors.
        if (bloomBit < 128) {
            value = bloomBit < 64 ? (bloomBit < 32 ? injector.cbf0 : injector.cbf1) :
                (bloomBit < 96 ? injector.cbf2 : injector.cbf3);
        }
        else {
            value = bloomBit < 192 ? (bloomBit < 160 ? injector.cbf4 : injector.cbf5) :
                (bloomBit < 224 ? injector.cbf6 : injector.cbf7);
        }
        // If the ancestor bloom filter value has the bit corresponding to the directive, traverse up to
        // find the specific injector. If the ancestor bloom filter does not have the bit, we can abort.
        injector = (value & mask) ? injector.parent : null;
    }
    return null;
}
function bloomFindPossibleInjector ( startInjector , bloomBit , flags ) { // Create a mask that targets the specific bit associated with the directive we're looking for. // JS bit operations are 32 bits, so this will be a number between 2^0 and 2^31, corresponding // to bit positions 0 - 31 in a 32 bit integer. var mask = 1 << bloomBit ; // Traverse up the injector tree until we find a potential match or until we know there *isn't* a // match. var injector = flags & 4 /* SkipSelf */ ? startInjector . parent : startInjector ; while ( injector ) { // Our bloom filter size is 256 bits, which is eight 32-bit bloom filter buckets: // bf0 = [0 - 31], bf1 = [32 - 63], bf2 = [64 - 95], bf3 = [96 - 127], etc. // Get the bloom filter value from the appropriate bucket based on the directive's bloomBit. var value = void 0 ; if ( bloomBit < 128 ) { value = bloomBit < 64 ? ( bloomBit < 32 ? injector . bf0 : injector . bf1 ) : ( bloomBit < 96 ? injector . bf2 : injector . bf3 ) ; } else { value = bloomBit < 192 ? ( bloomBit < 160 ? injector . bf4 : injector . bf5 ) : ( bloomBit < 224 ? injector . bf6 : injector . bf7 ) ; } // If the bloom filter value has the bit corresponding to the directive's bloomBit flipped on, // this injector is a potential match. if ( ( value & mask ) === mask ) { return injector ; } else if ( flags & 2 /* Self */ || flags & 1 /* Host */ && ! sameHostView ( injector ) ) { return null ; } // If the current injector does not have the directive, check the bloom filters for the ancestor // injectors (cbf0 - cbf7). These filters capture *all* ancestor injectors. if ( bloomBit < 128 ) { value = bloomBit < 64 ? ( bloomBit < 32 ? injector . cbf0 : injector . cbf1 ) : ( bloomBit < 96 ? injector . cbf2 : injector . cbf3 ) ; } else { value = bloomBit < 192 ? ( bloomBit < 160 ? injector . cbf4 : injector . cbf5 ) : ( bloomBit < 224 ? injector . cbf6 : injector . cbf7 ) ; } // If the ancestor bloom filter value has the bit corresponding to the directive, traverse up to // find the specific injector. If the ancestor bloom filter does not have the bit, we can abort. injector = ( value & mask ) ? injector . parent : null ; } return null ; }
Finds the closest injector that might have a certain directive.

Each directive corresponds to a bit in an injector's bloom filter. Given the bloom bit to
check and a starting injector, this function traverses up injectors until it finds an
injector that contains a 1 for that bit in its bloom filter. A 1 indicates that the
injector may have that directive. It only *may* have the directive because directives begin
to share bloom filter bits after the BLOOM_SIZE is reached, and it could correspond to a
different directive sharing the bit.

Note: We can skip checking further injectors up the tree if an injector's cbf structure
has a 0 for that bloom bit. Since cbf contains the merged value of all the parent
injectors, a 0 in the bloom bit indicates that the parents definitely do not contain
the directive and do not need to be checked.

@param injector The starting node injector to check
@param  bloomBit The bit to check in each injector's bloom filter
@param  flags The injection flags for this injection site (e.g. Optional or SkipSelf)
@returns An injector that might have the directive
Finds the closest injector that might have a certain directive .