Giter Club home page Giter Club logo

Comments (3)

daishengdong avatar daishengdong commented on July 17, 2024

logically, if you take the second parameter "list" as a node of one certain list(the first node of the list), the "add tail" logical to a list can be treated as a logic of "add prev" to a certain node(the first node of the list), the code is just equivalent to:

void tos_list_add_prev(k_list_t *node, k_list_t *first_node_of_the_list) {
   balabala
}

but semantically, we take the second parameter "list" as a list rather than a node, as a list, "add tail" is a more reasonable function name rather than "add prev"(what's the meaning of add prev to a list?)

as to the "tos_list_add", just consider it as "add head" to a list.

from tobudos.

yang-an-china avatar yang-an-china commented on July 17, 2024

ho ho ho,dude, A ring list designed.

from tobudos.

daishengdong avatar daishengdong commented on July 17, 2024

tos_list.h is an implement of double linked list, aka ring list, each node has another link to the previous one, more memory space but faster performance to do delete/insert operation, widely used in kernel which cares about the delete/insert performance a lot.

tos_slist.h is an implement of single linked list, each node only has a link to the next one, with less memory space but less good at the "tail add" or delete operation.

from tobudos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.